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

Reopen 4528403: JList checks ListModel equality incorrectly

XMLWordPrintable

    • x86
    • windows_nt, windows_xp



      Name: jk109818 Date: 01/30/2003


      FULL PRODUCT VERSION :
      java version "1.4.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)


      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows XP [Version 5.1.2600]

      ADDITIONAL OPERATING SYSTEMS :
      all


      A DESCRIPTION OF THE PROBLEM :
      Bug 4528403 was evaluated incorrectly and dismissed
      prematurely. Please refer to that report for details on
      the bug and how to reproduce it.

      It is obviously unreasonable to change the way
      SwingPropertyChangeSupport compares values in all cases.
      However, for JList ListModels, it is imperative that they
      be compared by identity, not by value/contents. After
      all, listeners are added to an object and not to its
      contents; it's irrelevant whether two list models have the
      same contents at the time a new model is set.

      When firing property changes, some properties need to be
      compared by value, others by identity.
      SwingPropertyChangeSupport needs to support both of these
      use cases.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      When doing JList.setModel with a different model, the list
      should start listening to events on the new model. It
      doesn't.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER WORKAROUND :
      Change the equals method of all list models used by the
      application to compare identities, breaking all code that
      relies on the usual equals contract (value comparison).

      Wrap every list model in a decorator that intercepts
      equals calls and compares by identity before passing the
      model to Swing.
      (Review ID: 178631)
      ======================================================================

            pbansal Pankaj Bansal (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: