groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Balachandran Sivakumar <benignb...@gmail.com>
Subject Re: Different behaviour for @Sortable 2.3.6+
Date Thu, 12 Nov 2015 04:51:20 GMT
Hi Schalk,

This works on 2.4.5

@EqualsAndHashCode(excludes = ['config'])
@Sortable(excludes = ['config'])
@TupleConstructor
@ToString
class Foo {
    String version
    File config
}

I just have @Sortable annotation. From Groovy 2.3, Sortable implements
Comparable is what I understand from the Groovy Goodness page on this
topic[1]. So, just the class which is annotated with @Sortable is enough. I
think We don't have to implement an "interface" at all. Thanks

[1]
http://mrhaki.blogspot.in/2014/05/groovy-goodness-use-sortable-annotation.html



On Wed, Nov 11, 2015 at 11:03 PM, Schalk Cronjé <ysb33r@gmail.com> wrote:

> Bala,
>
> That does not make sense, as the following will also fail:
>
> interface Foo extends Comparable {
>   String getVersion()
>   File getLocation()
> }
>
> @EqualsAndHashCode(excludes=['location'])
> @TupleConstructor
> @Sortable(excludes=['location'])
> @ToString
> class Bar implements Foo {
>   String version
>   File location
> }
>
>
> On 11/11/2015 16:55, Balachandran Sivakumar wrote:
>
> Hi Schalk,
>
>
>
> On Wed, Nov 11, 2015 at 9:09 PM, Schalk Cronjé <ysb33r@gmail.com> wrote:
>
>> This following code works under 2.3.3, but fails under 2.3.6 - 2.4.5
>>
>> @EqualsAndHashCode(excludes=['location'])
>> @TupleConstructor
>> @Sortable(excludes=['location'])
>> @ToString
>> class Bar implements Comparable {
>>
>>
>            I think @Sortable automatically makes it Comparable. So, we
> don't have to "implement" Comparable if we use the @Sortable annotation.
> Without the implements Comparable part, this works fine for me on groovy
> 2.4.5. Thanks
>
>
> --
> Thank you
> Balachandran Sivakumar
>
>
>
> --
> Schalk W. Cronjé
> Twitter / Ello / Toeter : @ysb33r
>
>


-- 
Thank you
Balachandran Sivakumar

Mime
View raw message