You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Michael Rüegg <ru...@gmail.com> on 2016/05/16 15:05:45 UTC
ClassNotFoundException when using ASTTransformationCustomizer(TypeChecked)
Hi,
I have a DSL which I can successfully execute as long as I don’t add an ASTTransformationCustomizer(TypeChecked) to check for compiler errors. But as soon as I add this customizer (uncomment in the following snippet), I get a ClassNotFoundException for groovy.lang.GroovyObject:
class DSLRunner {
def run(String dsl) {
def config = new CompilerConfiguration(CompilerConfiguration.DEFAULT)
config.scriptBaseClass = MyScript.class.name
// The following line throws a ClassNotFoundException for groovy.lang.GroovyObject:
// config.addCompilationCustomizers(new ASTTransformationCustomizer(TypeChecked))
ClassLoader parentClassLoader = DSLRunner.classLoader
def groovyClassLoader = new GroovyClassLoader(parentClassLoader, config)
Class<Script> clazz = groovyClassLoader.parseClass(dsl)
def binding = new Binding()
Script script = InvokerHelper.createScript(clazz, binding)
def myScript = (MyScript) script
script.run()
}
}
Any ideas what I’ve done wrong?
Thanks in advance,
Michael