Debugging groovy closure created in ASTTransformations


I am using a groovy AST to wrap all code in my function. This happens without the IDE knowing about it because it happens at runtime. Therefore when I setup my breakpoint, it thinks the breakpoint is at file Flow.groovy:23 but at runtime, because the closure is a separate class, the breakpoint really needs to be in another closure class at a different location.

I tried the following using the IDE. I wrote a groovy file with a closure in it. I set a breakpoint in the closure before I start to debug this. The first image is before I started to debug. Notice breakpoint info reflecting the same file name. But during debug, the breakpoint is actually in a diffferent class/location. The breakpoint info shows this to be different from the original breakpoint. How does Groovy achieve this? I possibly need to do something similar right?

Please sign in to leave a comment.