Re: re-using a comparison closure

2016-05-16 Thread Guy Matz
Grumble. Still doesn't work, but it may be because I'm working within a DSL (Artifactory) Thanks!!! On Mon, May 16, 2016 at 12:01 PM, Sergei Egorov wrote: > Make it static, i.e. append "static" before "def" > > On Mon, May 16, 2016 at 6:57 PM Guy Matz

Re: re-using a comparison closure

2016-05-16 Thread Sergei Egorov
Make it static, i.e. append "static" before "def" On Mon, May 16, 2016 at 6:57 PM Guy Matz wrote: > Thanks! Not working, though. Getting: > No such property: compareVersions for class: Sorters > > with: > > class Sorters { > def compareVersions = { afile, bfile -> >

Re: re-using a comparison closure

2016-05-16 Thread Guy Matz
Thanks! Not working, though. Getting: No such property: compareVersions for class: Sorters with: class Sorters { def compareVersions = { afile, bfile -> return getVersion(afile).toInteger() <=> getVersion(bfile).toInteger() } } and called with:

Re: re-using a comparison closure

2016-05-16 Thread Søren Berg Glasius (GR8Conf EU)
Hi  You can define it in a class as a static closure class Sorters {      static compareVersions =  { a,b ->          return getVersion(a).toInteger() <=> getVersion(b).toInteger()      } } and use it like: list.sort(Sorters.compareVersions) Best regards, Søren Berg Glasius GR8Conf Europe

Re: re-using a comparison closure

2016-05-16 Thread Guy Matz
Thanks! Now, I have a number of methods that need access to that closure . . . Can I make the closure global? Is there a better way? Thanks again, Guy On Mon, May 16, 2016 at 11:30 AM, Søren Berg Glasius (GR8Conf EU) < sbglas...@gr8conf.org> wrote: > Hi Guy > > Just assign the variable > >

ClassNotFoundException when using ASTTransformationCustomizer(TypeChecked)

2016-05-16 Thread Michael Rüegg
Hi, I have a DSL which I can successfully execute as long as I don’t add an ASTTransformationCustomizer(TypeChecked) to check for compiler errors. But as soon as I add this customizer (uncomment in the following snippet), I get a ClassNotFoundException for groovy.lang.GroovyObject: class