groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From C├ędric Champeau <>
Subject Properties and multi-getters
Date Fri, 21 Aug 2015 15:35:05 GMT
Hi guys,

While migrating Gradle to Groovy 2.4.4, I spent several hours debugging an
integration test that mysteriously failed under 2.4.4. It took me a lot of
time to figure out that the offending line was this one:

In Groovy 2.3, `wildcard` called `isWildcard`. Since we added support for
multiple setters (I think it is related, but not 100% sure), the behavior
seem to have changed: now Groovy calls `getWildcard`.

But as you can see, there's a culprit: `getWildcard` is a static method,
while `isWildcard` is an instance one. How silly!

I think this should be a compile time error (having both a static `get`
method and an instance `is` one, and the reverse).

It shouldn't be a problem to have both static or both instance methods, as
long as the behavior is deterministic. That is, if you find both:

boolean getA()
boolean isA()

and that you access the property using:


It should *always* be the same method which is called. My preference would
go with the "is" version first, but I'm not sure we make any guarantee on


View raw message