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

@EqualsAndHashCode : excludes does not work correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8-rc-4
    • 1.8.0
    • ast builder
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: