public inbox for java-prs@sourceware.org help / color / mirror / Atom feed
* [Bug swing/21065] javax.swing.event.EventListenerList.getListenerList() implemented wrong [not found] <bug-21065-10444@http.gcc.gnu.org/bugzilla/> @ 2005-10-16 1:41 ` pinskia at gcc dot gnu dot org 0 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-10-16 1:41 UTC (permalink / raw) To: java-prs -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|4.0.0 |pre-0.18 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21065 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [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-23 15:53 ` [Bug SWING/21065] " pinskia at gcc dot gnu dot org ` (3 more replies) 0 siblings, 4 replies; 5+ 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] 5+ messages in thread
* [Bug SWING/21065] javax.swing.event.EventListenerList.getListenerList() implemented wrong 2005-04-17 0:11 [Bug java/21065] New: " gruni dot ca at gmail dot com @ 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) 3 siblings, 0 replies; 5+ 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] 5+ messages in thread
* [Bug SWING/21065] javax.swing.event.EventListenerList.getListenerList() implemented wrong 2005-04-17 0:11 [Bug java/21065] New: " gruni dot ca at gmail dot com 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 3 siblings, 0 replies; 5+ 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] 5+ messages in thread
* [Bug SWING/21065] javax.swing.event.EventListenerList.getListenerList() implemented wrong 2005-04-17 0:11 [Bug java/21065] New: " gruni dot ca at gmail dot com 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 3 siblings, 0 replies; 5+ 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] 5+ messages in thread
* [Bug SWING/21065] javax.swing.event.EventListenerList.getListenerList() implemented wrong 2005-04-17 0:11 [Bug java/21065] New: " gruni dot ca at gmail dot com ` (2 preceding siblings ...) 2005-04-25 9:50 ` konqueror at gmx dot de @ 2005-04-26 20:23 ` tromey at gcc dot gnu dot org 3 siblings, 0 replies; 5+ 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] 5+ messages in thread
end of thread, other threads:[~2005-10-16 1:41 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <bug-21065-10444@http.gcc.gnu.org/bugzilla/> 2005-10-16 1:41 ` [Bug swing/21065] javax.swing.event.EventListenerList.getListenerList() implemented wrong pinskia at gcc dot gnu dot org 2005-04-17 0:11 [Bug java/21065] New: " gruni dot ca at gmail dot com 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).