You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (JIRA)" <ji...@apache.org> on 2019/01/17 16:21:00 UTC
[jira] [Created] (GROOVY-8959) NPE in StaticVerifier
Eric Milles created GROOVY-8959:
-----------------------------------
Summary: NPE in StaticVerifier
Key: GROOVY-8959
URL: https://issues.apache.org/jira/browse/GROOVY-8959
Project: Groovy
Issue Type: Bug
Components: Compiler
Affects Versions: 2.5.5, 2.4.16
Reporter: Eric Milles
I don't have the exact code that created this error, but the fix seems pretty simple.
{code:java}
// 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()) {
*/
if (ve.getAccessedVariable() instanceof DynamicVariable || !ve.isInStaticContext()) {
// GRECLIPSE end
addVariableError(ve);
}
}
{code}
{code}
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
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)