Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.4.16, 2.5.5
-
None
Description
I don't have the exact code that created this error, but the fix seems pretty simple.
// excerpt from StaticVerifier.visitConstructorOrMethod public void visitVariableExpression(VariableExpression ve) { if (exceptions.contains(ve.getName())) return; /* GRECLIPSE edit -- VariableExpression.isInStaticContext is null safe Variable av = ve.getAccessedVariable(); if (av instanceof DynamicVariable || !av.isInStaticContext()) { // this is line 96 */ if (ve.getAccessedVariable() instanceof DynamicVariable || !ve.isInStaticContext()) { // GRECLIPSE end addVariableError(ve); } }
java.lang.NullPointerException at org.codehaus.groovy.control.StaticVerifier$1.visitVariableExpression(StaticVerifier.java:96) at org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72) at org.codehaus.groovy.ast.CodeVisitorSupport.visitPropertyExpression(CodeVisitorSupport.java:302) at org.codehaus.groovy.ast.expr.PropertyExpression.visit(PropertyExpression.java:57) at org.codehaus.groovy.control.StaticVerifier.visitConstructorOrMethod(StaticVerifier.java:91) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructor(ClassCodeVisitorSupport.java:162) at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1210) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:54) at org.codehaus.groovy.control.StaticVerifier.visitClass(StaticVerifier.java:54) at org.codehaus.groovy.control.CompilationUnit$13.call(CompilationUnit.java:241) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1143) ... 20 more