Hello folks In my AST transformation that takes a block of code and executes it as a closure, I am unable to set a breakpoint inside the block of code at runtime. This however works if the closure was written as part of the script directly. What am I missing?
Sample Groovy code class MyClass { void method() { String b = "" throw new WTHException() } } My invoker class InvokeClosure { static ClassNode NODE = ClassHelper.makeNode(InvokeClosure.class) static void invokeClosure(Closure<?> closure) { closure.call() } } My AST transformation void visitMethod(MethodNode methodNode) { ClosureExpression closureExpression = GeneralUtils.closureX(methodNode.getCode()) // NODE is a StaticMethodCallExpression methodExpression = GeneralUtils.callX(InvokeClosure.NODE, "invokeClosure", GeneralUtils.args(closure)) methodNode.setCode(GeneralUtils.stmt(methodExpression)) } When I use this AST transformation, it compiles fine, invokeClosure gets called when I invoke my method, but I am not able to set a breakpoint at the method() function in line 1. The IDE disables my breakpoint on execution. What am I missing in my transformation? I tried setting positions for my closure, and my statement. Still did not work. Thank you for your responses regards