Groovy script AST transforms


I have my own AST transformations in groovy. I use intellij and want the compiler to pick up my AST transformations as part of compiling/validating the groovy script

One example is this. I have an annotation @NoCode which I will use to ensure that a function has no code in it. so

def func1() {} // is valid

def func2() {func1();} // must be invalid, therefore expecting to see red squiggly lines

My AST transforms work and I am able to get the compile error I use when I see code. How do I now integrate this with intellij? I tried using a config.groovy with this transformation in it and setting this config.groovy file in the configscript option for the groovy compiler. That did not work.

Any help is appreciated

My config.groovy is this


def analysis = new ASTTransformationCustomizer(NoCode)

Please sign in to leave a comment.