groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Rüegg <rueegg.mich...@gmail.com>
Subject Strange behaviour with binding resolution in Groovy based DSL
Date Mon, 26 Sep 2016 07:02:37 GMT
Hi,

I have a Groovy based DSL in which I want to access variables from declared bindings. Here's
my DSL implementation:

https://gist.github.com/MichaelRueegg/f3f09aeb5853bdb58ca017eb1d4d7a30

As you can see, when I bind the variable magicValue with def (DSL_OK), I can access its value
in my DSL, whereas otherwise (DSL_NOT_OK) I get a

java.lang.NullPointerException: Cannot get property 'magicValue' on null object

What am I doing wrong? How can I access the variable magicValue without the def helper declaration?
I think it has something to do with calling rehydrate on the closure where I could pass this
instead of null, but this does not seem to work with nested object hierarchies (Foo->Bar).

Any help is much appreciated.

Thanks, 
Michael
Mime
View raw message