You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Graeme Rocher (JIRA)" <ji...@apache.org> on 2015/08/26 11:15:46 UTC

[jira] [Created] (GROOVY-7560) ASTTransformationCustomizer can only be applied once when using GroovyClassLoader.parseClass(..)

Graeme Rocher created GROOVY-7560:
-------------------------------------

             Summary: ASTTransformationCustomizer can only be applied once when using GroovyClassLoader.parseClass(..)
                 Key: GROOVY-7560
                 URL: https://issues.apache.org/jira/browse/GROOVY-7560
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.4.4
            Reporter: Graeme Rocher


If you add a compilation customiser to a GroovyClassLoader:

{code}
        compilerConfiguration.addCompilationCustomizers( new ASTTransformationCustomizer(new ViewsTransform()) )
        classLoader = new GroovyClassLoader(Thread.currentThread().contextClassLoader, compilerConfiguration)
{code}

Then the customizer is only applied for the first call to `parseClass` any subsequent calls don't have it applied.

It appears customizers are treated as global transforms and therefore only applied once, although even this seems wrong as all future calls of `parseClass` should have the customizer applied too.

See https://github.com/apache/incubator-groovy/blob/master/src/main/org/codehaus/groovy/control/customizers/ASTTransformationCustomizer.groovy#L299



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)