On Tue, Oct 25, 2016 at 1:34 PM, Dinko Srkoč <dinko.sr...@gmail.com> wrote: > On 25 October 2016 at 16:02, VG <vito...@gmail.com> wrote: >> Hi there, >> >> why this does not work? >> >> class Example { >> @Delegate Date when >> } >> >> def x = new Example(when: new Date()) >> x.next() // fails >> >> I checked >> http://docs.groovy-lang.org/latest/html/groovy-jdk/java/util/Date.html and >> the next method is available there? Should not the method next be available >> through @delegate? > > `next()` is not really a method on `java.util.Date`, but a Groovy's extension. > > `Date`'s methods are all there. E.g. > > x.time // works
And just to interject the question the OP is probably going to ask: Why should it matter whether it's an "extension" or not? Is it documented that the methods available on a Delegate exclude what Groovy has added to the class?