Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.0
-
None
Description
Running this script:
import groovy.util.logging.Log4j @Log4j class Test { void doit() { log.debug( 'woo' ) } static main( args ) { new Test().doit() } }
Causes:
BUG! exception in phase 'class generation' in source unit 'log4jannotation.groovy' ClassNode#getTypeClass for org.apache.log4j.Logger is called before the type class is set at org.codehaus.groovy.ast.ClassNode.getTypeClass(ClassNode.java:1327) at org.codehaus.groovy.classgen.asm.BytecodeHelper.box(BytecodeHelper.java:596) at org.codehaus.groovy.classgen.asm.OperandStack.box(OperandStack.java:205) at org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:233) at org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:221) at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:270) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:229) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:76) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:60) at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:334) at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:649) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:67) at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:604) at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeExpressionStatement(OptimizingStatementWriter.java:354) at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:510) at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40) at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:81) at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeBlockStatement(OptimizingStatementWriter.java:155) at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:456) at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112) at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:320) at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:277) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123) at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:397) at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1056) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50) at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:181) at org.codehaus.groovy.control.CompilationUnit$14.call(CompilationUnit.java:783) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1024) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:562) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:540) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:517) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:283) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:264) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:613) at groovy.lang.GroovyShell.run(GroovyShell.java:480) at groovy.lang.GroovyShell.run(GroovyShell.java:163) at groovy.lang.GroovyShell$run.call(Unknown Source) at groovy.ui.Console$_runScriptImpl_closure17.doCall(Console.groovy:931) at groovy.ui.Console$_runScriptImpl_closure17.doCall(Console.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:904) at groovy.lang.Closure.call(Closure.java:410) at groovy.lang.Closure.call(Closure.java:404) at groovy.lang.Closure.run(Closure.java:488) at java.lang.Thread.run(Thread.java:680)
Attachments
Issue Links
- is related to
-
GROOVY-5557 @Slf4j throws error in Groovy 2.0
- Closed