public inbox for java-prs@sourceware.org help / color / mirror / Atom feed
* [Bug java/21065] New: javax.swing.event.EventListenerList.getListenerList() implemented wrong @ 2005-04-17 0:11 gruni dot ca at gmail dot com 2005-04-17 0:46 ` [Bug java/21065] " gruni dot ca at gmail dot com ` (6 more replies) 0 siblings, 7 replies; 8+ messages in thread From: gruni dot ca at gmail dot com @ 2005-04-17 0:11 UTC (permalink / raw) To: java-prs I am using a custom Class wich throws events, by using this I rely on the EventListenerList Class to hold my Eventlisteners. The Method getListenerList is used by the method protected void fireFooXXX() { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==FooListener.class) { // Lazily create the event: if (fooEvent == null) fooEvent = new FooEvent(this); ((FooListener)listeners[i+1]).fooXXX(fooEvent); } } } which is the standard Method given in the API to fire Events to all EventListeners. This Method relies on the correct implementation of getListenerList() which should according to the API Documentation of Java by SUN http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/event/EventListenerList.html#getListenerList() [quote] getListenerList public Object[] getListenerList() Passes back the event listener list as an array of ListenerType-listener pairs. Note that for performance reasons, this implementation passes back the actual data structure in which the listener data is stored internally! This method is guaranteed to pass back a non-null array, so that no null-checking is required in fire methods. A zero-length array of Object should be returned if there are currently no listeners. WARNING!!! Absolutely NO modification of the data contained in this array should be made -- if any such manipulation is necessary, it should be done on a copy of the array returned rather than the array itself. [/quote] The API doc says "Passes back the event listener list as an array of ListenerType-listener pairs." my understanding of pairs is multiples of two, so the EventListenerList can never contain 1 or 3 entries or any other odd number. But when adding one Eventlistener to such a list it really just adds this EventListener resulting in a getListenerList() which returns one Element, which is simply wrong. A Testcase will follow as soon as I have written one. btw this is my system: WinXP SP2 gcj 4.0 20050324 from thisiscool.com Regards, Andreas -- Summary: javax.swing.event.EventListenerList.getListenerList() implemented wrong Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: critical Priority: P1 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gruni dot ca at gmail dot com CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21065 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug java/21065] javax.swing.event.EventListenerList.getListenerList() implemented wrong 2005-04-17 0:11 [Bug java/21065] New: javax.swing.event.EventListenerList.getListenerList() implemented wrong gruni dot ca at gmail dot com @ 2005-04-17 0:46 ` gruni dot ca at gmail dot com 2005-04-17 0:57 ` gruni dot ca at gmail dot com ` (5 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: gruni dot ca at gmail dot com @ 2005-04-17 0:46 UTC (permalink / raw) To: java-prs ------- Additional Comments From gruni dot ca at gmail dot com 2005-04-17 00:45 ------- Created an attachment (id=8663) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8663&action=view) Simple Testcase showing that addind a EventListener increments the list by one This is a testcase I wrote, I compiled it with gcj --main=GcjEventListenerListTest -o EventTest.exe GcjEventListenerListTest.java the output should be similar to JDK if implemented correctly JDK output: should be=2 is=2 should be=4 is=4 GCJ output: should be=2 is=1 should be=4 is=2 That's all I have -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21065 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug java/21065] javax.swing.event.EventListenerList.getListenerList() implemented wrong 2005-04-17 0:11 [Bug java/21065] New: javax.swing.event.EventListenerList.getListenerList() implemented wrong gruni dot ca at gmail dot com 2005-04-17 0:46 ` [Bug java/21065] " gruni dot ca at gmail dot com @ 2005-04-17 0:57 ` gruni dot ca at gmail dot com 2005-04-23 15:51 ` [Bug libgcj/21065] " rmathew at gcc dot gnu dot org ` (4 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: gruni dot ca at gmail dot com @ 2005-04-17 0:57 UTC (permalink / raw) To: java-prs -- What |Removed |Added ---------------------------------------------------------------------------- Attachment #8663|Simple Testcase showing that|Simple Testcase showing that description|addind a EventListener |adding a EventListener |increments the list by one |increments the list by one http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21065 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libgcj/21065] javax.swing.event.EventListenerList.getListenerList() implemented wrong 2005-04-17 0:11 [Bug java/21065] New: javax.swing.event.EventListenerList.getListenerList() implemented wrong gruni dot ca at gmail dot com 2005-04-17 0:46 ` [Bug java/21065] " gruni dot ca at gmail dot com 2005-04-17 0:57 ` gruni dot ca at gmail dot com @ 2005-04-23 15:51 ` rmathew at gcc dot gnu dot org 2005-04-23 15:53 ` [Bug SWING/21065] " pinskia at gcc dot gnu dot org ` (3 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: rmathew at gcc dot gnu dot org @ 2005-04-23 15:51 UTC (permalink / raw) To: java-prs -- What |Removed |Added ---------------------------------------------------------------------------- Component|java |libgcj http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21065 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug SWING/21065] javax.swing.event.EventListenerList.getListenerList() implemented wrong 2005-04-17 0:11 [Bug java/21065] New: javax.swing.event.EventListenerList.getListenerList() implemented wrong gruni dot ca at gmail dot com ` (2 preceding siblings ...) 2005-04-23 15:51 ` [Bug libgcj/21065] " rmathew at gcc dot gnu dot org @ 2005-04-23 15:53 ` pinskia at gcc dot gnu dot org 2005-04-25 8:57 ` roman at kennke dot org ` (2 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-04-23 15:53 UTC (permalink / raw) To: java-prs -- What |Removed |Added ---------------------------------------------------------------------------- Component|libgcj |SWING http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21065 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug SWING/21065] javax.swing.event.EventListenerList.getListenerList() implemented wrong 2005-04-17 0:11 [Bug java/21065] New: javax.swing.event.EventListenerList.getListenerList() implemented wrong gruni dot ca at gmail dot com ` (3 preceding siblings ...) 2005-04-23 15:53 ` [Bug SWING/21065] " pinskia at gcc dot gnu dot org @ 2005-04-25 8:57 ` roman at kennke dot org 2005-04-25 9:50 ` konqueror at gmx dot de 2005-04-26 20:23 ` tromey at gcc dot gnu dot org 6 siblings, 0 replies; 8+ messages in thread From: roman at kennke dot org @ 2005-04-25 8:57 UTC (permalink / raw) To: java-prs ------- Additional Comments From roman at kennke dot org 2005-04-25 08:57 ------- I have tested this against the current GNU Classpath code. At least there it works correctly. I suppose the EventListenerList from GNU Classpath has to be merged into GCJ, if it isn't done yet (I haven't checked GCJ). /Roman -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21065 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug SWING/21065] javax.swing.event.EventListenerList.getListenerList() implemented wrong 2005-04-17 0:11 [Bug java/21065] New: javax.swing.event.EventListenerList.getListenerList() implemented wrong gruni dot ca at gmail dot com ` (4 preceding siblings ...) 2005-04-25 8:57 ` roman at kennke dot org @ 2005-04-25 9:50 ` konqueror at gmx dot de 2005-04-26 20:23 ` tromey at gcc dot gnu dot org 6 siblings, 0 replies; 8+ messages in thread From: konqueror at gmx dot de @ 2005-04-25 9:50 UTC (permalink / raw) To: java-prs ------- Additional Comments From konqueror at gmx dot de 2005-04-25 09:50 ------- As you can see at http://developer.classpath.org/compare/classpath-libgcj/libgcj-classpath-compare.html this class is merged. This page is updated twice a day so pretty uptodate normally. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21065 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug SWING/21065] javax.swing.event.EventListenerList.getListenerList() implemented wrong 2005-04-17 0:11 [Bug java/21065] New: javax.swing.event.EventListenerList.getListenerList() implemented wrong gruni dot ca at gmail dot com ` (5 preceding siblings ...) 2005-04-25 9:50 ` konqueror at gmx dot de @ 2005-04-26 20:23 ` tromey at gcc dot gnu dot org 6 siblings, 0 replies; 8+ messages in thread From: tromey at gcc dot gnu dot org @ 2005-04-26 20:23 UTC (permalink / raw) To: java-prs ------- Additional Comments From tromey at gcc dot gnu dot org 2005-04-26 20:23 ------- This works for me with 4.0 and cvs trunk. -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED Target Milestone|--- |4.0.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21065 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-04-26 20:23 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-04-17 0:11 [Bug java/21065] New: javax.swing.event.EventListenerList.getListenerList() implemented wrong gruni dot ca at gmail dot com 2005-04-17 0:46 ` [Bug java/21065] " gruni dot ca at gmail dot com 2005-04-17 0:57 ` gruni dot ca at gmail dot com 2005-04-23 15:51 ` [Bug libgcj/21065] " rmathew at gcc dot gnu dot org 2005-04-23 15:53 ` [Bug SWING/21065] " pinskia at gcc dot gnu dot org 2005-04-25 8:57 ` roman at kennke dot org 2005-04-25 9:50 ` konqueror at gmx dot de 2005-04-26 20:23 ` tromey at gcc dot gnu dot org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).