Posts Tagged ‘AST debugging’

Trials and tribulations with groovy AST transforms…

February 25, 2013 Leave a comment

Fell into this somewhat by accident – and its end up consuming a lot of play time to figure some of the stuff out – Information on what todo and how can be a little sparse, and it can be a bit of a bother to work with and get working – however its a useful to know exists when you need it.  However its not for the faint hearted.

What triggered this was my exploration of a Griffen transform @PropertyListener that you can add to @Bindable.  When i tired to import that transform into a SWT/grails/groovy project – it would not work as outlined.

so I went back to basics and tried to build it up from first principles.  I’ve tried to document what i went through in the process, from simple marker interfaces – through to those that take parameters that inform the transformation externally

Essentially what i think I found was that the example outlined in the griffen project – I couldn’t get to work at all and i ended passing either a closure as the property listener – or a String name of a field in your class that is a closure to make this work at all

I’ve attached a PDF of the tutorial and steps to go through, so i hope someone else finds it useful

So i now have a working transformation that seems to keep eclipse happy and doesn’t fail the IDE when applied to your class.  Its not ‘case hardened, and i’m still adding stuff to the ASTUtils library but ive attached the working zip file to have a peek at also

trials and tribulations in AST transformations v1.0

Actually wordpress free wont let me post a zip – so y’ll need to contact me for copy of the zip of the project











Categories: AST, Groovy Tags: , , ,
%d bloggers like this: