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

@EqualsAndHashCode : excludes does not work correctly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8-rc-4
    • Fix Version/s: 1.8.0
    • Component/s: ast builder
    • Labels:
      None
    • Environment:
      Ubuntu 10.10

      Description

      The following code should work. It fails in 1.8-rc4:

      import groovy.transform.EqualsAndHashCode
      
      @EqualsAndHashCode(excludes="b")
      class X {
          int a
          int b
      }
      
      x1 = new X(a:1, b:10)
      x2 = new X(a:1, b:100)
      
      assert x1 == x2
      assert x1.hashCode() == x2.hashCode() // failure here
      

        Attachments

          Activity

            People

            • Assignee:
              paulk Paul King
              Reporter:
              e.castro Emmanuel Castro
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: