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

Sortable AST transform replaces custom compareTo method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.0-beta-1, 2.5.7
    • 2.5.8, 3.0.0-beta-2
    • Compiler
    • None

    Description

      A class defined as

      @groovy.transform.Sortable
      class ClassUnderTest { 
          String name
          int age
          int compareTo(Object o) { 42 }
          int compareTo(ClassUnderTest o) { 42 }
      }
      

      Will override the second definition of compareTo every single time.

      In contrast with @Canonical for example where explicit toString() is not overridden.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              aalmiray Andres Almiray
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: