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:16:45 UTC
[jira] [Commented] (GROOVY-7560) ASTTransformationCustomizer can
only be applied once when using GroovyClassLoader.parseClass(..)
[ https://issues.apache.org/jira/browse/GROOVY-7560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14712773#comment-14712773 ]
Graeme Rocher commented on GROOVY-7560:
---------------------------------------
My current workaround:
{code}
// Had to do this hack because of a Groovy bug where ASTTransformationCustomizer are only applied once
compilerConfiguration.compilationCustomizers.remove(currentCustomizer)
currentCustomizer = new ASTTransformationCustomizer(new ViewsTransform())
compilerConfiguration.compilationCustomizers.add(currentCustomizer)
{code}
> 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)