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
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 ->
>
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:
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
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
>
>
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