You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/02/03 22:30:00 UTC

[jira] [Closed] (GROOVY-5736) Log4j, Commons, Slf4j ast transforms are broken in Groovy-Eclipse

     [ https://issues.apache.org/jira/browse/GROOVY-5736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-5736.
-----------------------------

> Log4j, Commons, Slf4j ast transforms are broken in Groovy-Eclipse
> -----------------------------------------------------------------
>
>                 Key: GROOVY-5736
>                 URL: https://issues.apache.org/jira/browse/GROOVY-5736
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.0.4
>            Reporter: Andrew Eisenberg
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 2.5.16, 3.0.10, 4.0.0-rc-2
>
>
> Since Groovy-Eclipse moved to using the 2.0.4 compiler, the @Log4j and other log ast transformations are crashing the compiler.  This is because in GROOVY-5574, there was a move to call {{Class.forName()}} in the Log AST transformation.  In Groovy-Eclipse, you cannot use Class.forName since the classpath of the project is not on the classpath of the compiler.
> The workaround is to change {{org.codehaus.groovy.transform.LogASTTransformation.AbstractLoggingStrategy.classNode(String)}}.  Instead of throwing a {{GroovyRuntimeException}}, you could simply call and return {{ClassHelper.make(name);}}. 
> I know this adds code that was removed to fix GROOVY-5574, but for Groovy-Eclipse this is safe since {{ClassHelper.make(name);}} will correctly use the project's class path to generate the ClassNode and classloader issues will not happen.
> If you think that this solution is not a good one because of problems that could occur outside of eclipse, then we could talk about a different solution.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)