Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5736

Log4j, Commons, Slf4j ast transforms are broken in Groovy-Eclipse

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.4
    • 2.5.16, 3.0.10, 4.0.0-rc-2
    • Compiler
    • 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.

      Attachments

        Activity

          People

            emilles Eric Milles
            werdna Andrew Eisenberg
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: