Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.4
-
None
Description
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.