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

@EqualsAndHashCode should allow caching of hashCode values

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8-rc-1
    • 2.1.0-rc-2, 2.1.0
    • None
    • None

    Description

      NOTE: @ToString moved to linked issue

      For an immutable object, a hashcode value & toString value only need to be computed once and cached. Then the hashcode and toString methods can just return the cached values.

      The @ToString and @EqualsAndHashCode ast transformation should have options to allow for caching. For example:

      @ToString(cache=true)
      @EqualsAndHashCode(cache=true)

      Also, the @Immutable annotation should use the @ToString and @EqualsAndHashCode transformation with this caching capability enabled.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              leo.herbie Travis Schneeberger
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: