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

@EqualsAndHashCode assumes get style getters for boolean properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.6, 2.2.0-beta-1, 2.4.5
    • 2.4.8
    • xforms
    • None

    Description

      It basically means that equals() and hashCode() generated using @EqualsAsHashCode will throw MissingMethodException if you define only is style getters for a glass. I expected the following to pass but it doesn't:

      import groovy.transform.EqualsAndHashCode 
      
      @EqualsAndHashCode
      class A {
          boolean a
       
          boolean isA() { a }
      }
       
      def a1 = new A(a: true)
      def a2 = new A(a: true)
      assert a1.a
      assert a1.hashCode()
      assert a1 == a2
      

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              erdi Marcin Erdmann
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: