-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.4.0
-
sparc
-
solaris_2.6
Name: atR10191 Date: 02/13/2002
In package java.awt specifications for methods SomeClass.addSomeListener
do not specify behavior in case of multiple add...Listener(...Listener l) calls
with same listener.
And specifications for methods remove...Listener(...Listener l)
do not specify, what happens, if l has not previously been added to
the object, or l has been already removed.
(It's applyed to all listeners implementing EventListener interface)
Examples are:
//...
Component.addComponentListener(ComponentListener l)
Component.removeComponentListener(ComponentListener l)
Component.addFocusListener(FocusListener l)
Component.removeFocusListener(FocusListener l)
Component.addHierarchyBoundsListener(HierarchyBoundsListener l)
Component.removeHierarchyBoundsListener(HierarchyBoundsListener l)
Component.addInputMethodListener(InputMethodListener l)
//...
Toolkit.addAWTEventListener(AWTEventListener listener)
Toolkit.removeAWTEventListener(AWTEventListener listener)
//...
Window.addWindowListener(WindowListener l)
Window.removeWindowListener(WindowListener l)
//...
//
From common sense, one listener can be added
only once and removed also only once. It's not normal if listener
receives the same message several time.
But behaviour of the current jdk1.4 (merlin-rc1) is, surprisingly, quite
different.
In current implementation if one calls add...Listener(...Listener l)
twice with the same ...Listener, the ...Listener will recieve
every message twice.
It's caused by implementation of AWTEventMulticaster
This unexpected behaviour has to be stated and explained explicitly in order
to not confuse application developers
======================================================================
- relates to
-
JDK-4636161 no spec on multiple Toolkit.addAWTEventListener() calls for same listener
-
- Open
-