You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2019/06/07 03:19:00 UTC

[jira] [Resolved] (GROOVY-9161) Sortable AST transform replaces custom compareTo method

     [ https://issues.apache.org/jira/browse/GROOVY-9161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King resolved GROOVY-9161.
-------------------------------
       Resolution: Fixed
         Assignee: Paul King
    Fix Version/s: 3.0.0-beta-2
                   2.5.8

Should be fixed as part of GROOVY-9163.

> Sortable AST transform replaces custom compareTo method
> -------------------------------------------------------
>
>                 Key: GROOVY-9161
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9161
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 3.0.0-beta-1, 2.5.7
>            Reporter: Andres Almiray
>            Assignee: Paul King
>            Priority: Major
>             Fix For: 2.5.8, 3.0.0-beta-2
>
>
> A class defined as
> {code:java}
> @groovy.transform.Sortable
> class ClassUnderTest { 
>     String name
>     int age
>     int compareTo(Object o) { 42 }
>     int compareTo(ClassUnderTest o) { 42 }
> }
> {code}
> Will override the second definition of {{compareTo}} every single time.
> In contrast with {{@Canonical}} for example where explicit {{toString()}} is not overridden.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)