Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4637234

specs for add/remove...Listener() are incomplete

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.6

      Description



      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
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dav Andrei Dmitriev (Inactive)
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Imported:
                Indexed: