Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
This issue started after the upgrade from 3.0.7 -> 3.0.9
Given the following code:
class A { static class B { String throwC() { throw new C() } } class C extends RuntimeException { } }
The following exception is thrown.
BUG! exception in phase 'semantic analysis' in source unit 'ideaGroovyConsole.groovy' unexpected NullPointerExceptionBUG! exception in phase 'semantic analysis' in source unit 'ideaGroovyConsole.groovy' Caused by: java.lang.NullPointerException at org.codehaus.groovy.classgen.InnerClassVisitor.insertThis0ToSuperCall(InnerClassVisitor.java:304) at org.codehaus.groovy.classgen.InnerClassVisitor.passThisReference(InnerClassVisitor.java:284) at org.codehaus.groovy.classgen.InnerClassVisitor.visitConstructorCallExpression(InnerClassVisitor.java:145) at org.codehaus.groovy.ast.expr.ConstructorCallExpression.visit(ConstructorCallExpression.java:44) at org.codehaus.groovy.ast.CodeVisitorSupport.visitThrowStatement(CodeVisitorSupport.java:179) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitThrowStatement(ClassCodeVisitorSupport.java:236) at org.codehaus.groovy.ast.stmt.ThrowStatement.visit(ThrowStatement.java:41) at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:86) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:164) at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:138) at org.codehaus.groovy.classgen.InnerClassVisitor.visitConstructorOrMethod(InnerClassVisitor.java:114) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:106) at org.codehaus.groovy.ast.ClassNode.visitMethods(ClassNode.java:1099) at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1092) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52) at org.codehaus.groovy.classgen.InnerClassVisitor.visitClass(InnerClassVisitor.java:84) at org.codehaus.groovy.control.CompilationUnit.lambda$addPhaseOperations$4(CompilationUnit.java:214) at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:942)
Changing class C to be static causes it to work again