Groovy
  1. Groovy
  2. GROOVY-4916

Set equality fails if null elements are present

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.0
    • Fix Version/s: 1.8.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      java version "1.6.0_24"
      Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
      Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
      Ubuntu 10.04

      Description

      The following assertions work as expected in groovy 1.7.10, but fail in groovy 1.8.0

      First case:

      def foo = [ "a", null ] as Set
      assert foo.equals( foo )
      

      Second case:

      def foo = [ "a", null ] as Set
      def bar = [ "a", null ] as Set
      assert foo == bar
      assert foo.equals( bar )
      

      foo == foo happens to work, which leads me to believe that == tests for object identity first.

      I can workaround by testing Set equality using brute force, but it's very surprising.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Paul King
            Reporter:
            Ray A. Conner
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development