I'm not sure if this is already possible but is it possible to use @CompileStatic on just plain groovy scripts without wrapping the script in a class?
I'm using the GroovyClassLoader to parse and compile scripts dynamically and so it would be nice if scripts could use @CompileStatic
You can add a compiler customizer:
configuration.addCompilationCustomizers(
new ASTTransformationCustomizer(CompileStatic))
If you were on the command line you could provide a --configscript config.groovy. This answer has an example of how the script should look like:
withConfig(configuration) {
ast(groovy.transform.CompileStatic)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With