Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7267

avoid hashcode based equality check without equals

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.3.10, 2.4.1
    • groovy-jdk
    • None

    Description

      This is a follow-up issue on GROOVY-4101 and GROOVY-4124. I think there was a misunderstanding back then. Basically this code

      assert ([[1:2],[2:3]]-[["b":"a"]]) == [[1:2],[2:3]]

      can fail, because of the path that is taken with NumberAwareComperator. The hashcodes of the minus element first list entry and the hashcode of the source list first element are equal. Since they are both lists DefaultTypeTransformation.compareTo will fail and the hashcode equality is then used to decide that [1:2] is to be removed. This makes not really sense, thus the issue is for the removal of the equality case

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            blackdrag Jochen Theodorou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: