Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.1
-
None
Description
A problem which seems related to optional parameters (if you remove the optional param in the initPlugins signature, the NPE goes alway):
import groovy.transform.* @CompileStatic class Listener { void event() { initPlugins() } static initPlugins(ignoreBinary = false) {} } def l = new Listener() l.event()
Yields:
2 ao?t 2012 01:31:47 org.codehaus.groovy.runtime.StackTraceUtils sanitize ATTENTION: Sanitizing stacktrace: java.lang.NullPointerException at org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter.loadArguments(StaticInvocationWriter.java:274) at org.codehaus.groovy.classgen.asm.InvocationWriter.writeDirectMethodCall(InvocationWriter.java:129) at org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter.writeDirectMethodCall(StaticInvocationWriter.java:188) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:221) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:76) at org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter.makeCall(StaticInvocationWriter.java:406) 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:648) 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.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:509) 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.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:49) at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:455) 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:319) at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:276) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123) at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:396) 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:180) 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:951) at groovy.ui.Console$_runScriptImpl_closure17.doCall(Console.groovy) at sun.reflect.GeneratedMethodAccessor239.invoke(Unknown Source) 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) 2 ao?t 2012 01:31:47 org.codehaus.groovy.runtime.StackTraceUtils sanitize ATTENTION: Sanitizing stacktrace: groovy.lang.GroovyRuntimeException: NPE while processing ConsoleScript173 at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:198) 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:951) at groovy.ui.Console$_runScriptImpl_closure17.doCall(Console.groovy) at sun.reflect.GeneratedMethodAccessor239.invoke(Unknown Source) 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) Caused by: java.lang.NullPointerException