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

ListProperty.equals(list) fails while list.equals(listProperty) succeeds

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 8
    • 8
    • javafx
    • None

    Description

      The problem is that ListProperty (and associated classes) don't reimplement equals(). As a consequence, Object.equals is being used. This does instance equality. But this is wrong when compared with a list, instead it should do list element equality. Otherwise, we don't have transitive equality.

          [junit] Testsuite: javafx.beans.property.ListPropertyBaseTest
          [junit] Tests run: 24, Failures: 4, Errors: 0, Time elapsed: 0.119 sec
          [junit]
          [junit] Testcase: testBind_ListChange(javafx.beans.property.ListPropertyBaseTest): FAILED
          [junit] expected:<ListProperty [bound, value: []]> but was:<[]>
          [junit] junit.framework.AssertionFailedError: expected:<ListProperty [bound, value: []]> but was:<[]>
          [junit] at javafx.collections.MockListObserver.checkAddRemove(MockListObserver.java:102)
          [junit] at javafx.collections.MockListObserver.check1AddRemove(MockListObserver.java:90)
          [junit] at javafx.beans.property.ListPropertyBaseTest.testBind_ListChange(ListPropertyBaseTest.java:556)
          [junit]
          [junit]
          [junit] Testcase: testListChangeListener(javafx.beans.property.ListPropertyBaseTest): FAILED
          [junit] expected:<ListProperty [value: [java.lang.Object@cf768c, java.lang.Object@1f95c5d]]> but was:<[java.lang.Object@cf768c, java.lang.Object@1f95c5d]>
          [junit] junit.framework.AssertionFailedError: expected:<ListProperty [value: [java.lang.Object@cf768c, java.lang.Object@1f95c5d]]> but was:<[java.lang.Object@cf768c, java.lang.Object@1f95c5d]>
          [junit] at javafx.collections.MockListObserver.checkAddRemove(MockListObserver.java:102)
          [junit] at javafx.collections.MockListObserver.check1AddRemove(MockListObserver.java:90)
          [junit] at javafx.beans.property.ListPropertyBaseTest.testListChangeListener(ListPropertyBaseTest.java:150)
          [junit]
          [junit]
          [junit] Testcase: testSet_ListChange(javafx.beans.property.ListPropertyBaseTest): FAILED
          [junit] expected:<ListProperty [value: [java.lang.Object@cf768c, java.lang.Object@1f95c5d]]> but was:<[java.lang.Object@cf768c, java.lang.Object@1f95c5d]>
          [junit] junit.framework.AssertionFailedError: expected:<ListProperty [value: [java.lang.Object@cf768c, java.lang.Object@1f95c5d]]> but was:<[java.lang.Object@cf768c, java.lang.Object@1f95c5d]>
          [junit] at javafx.collections.MockListObserver.checkAddRemove(MockListObserver.java:102)
          [junit] at javafx.collections.MockListObserver.check1AddRemove(MockListObserver.java:90)
          [junit] at javafx.beans.property.ListPropertyBaseTest.testSet_ListChange(ListPropertyBaseTest.java:384)
          [junit]
          [junit]
          [junit] Testcase: testSetValue_ListChange(javafx.beans.property.ListPropertyBaseTest): FAILED
          [junit] expected:<ListProperty [value: [java.lang.Object@cf768c, java.lang.Object@1f95c5d]]> but was:<[java.lang.Object@cf768c, java.lang.Object@1f95c5d]>
          [junit] junit.framework.AssertionFailedError: expected:<ListProperty [value: [java.lang.Object@cf768c, java.lang.Object@1f95c5d]]> but was:<[java.lang.Object@cf768c, java.lang.Object@1f95c5d]>
          [junit] at javafx.collections.MockListObserver.checkAddRemove(MockListObserver.java:102)
          [junit] at javafx.collections.MockListObserver.check1AddRemove(MockListObserver.java:90)
          [junit] at javafx.beans.property.ListPropertyBaseTest.testSetValue_ListChange(ListPropertyBaseTest.java:458)
          [junit]

      Attachments

        Issue Links

          Activity

            People

              msladecek Martin Sládeček
              rbair Richard Bair (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: