groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Rüegg <>
Subject ClassNotFoundException when using ASTTransformationCustomizer(TypeChecked)
Date Mon, 16 May 2016 15:05:45 GMT

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 =
        // 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

Any ideas what I’ve done wrong?

Thanks in advance,
View raw message