Skip to content

NPE for super in anon. inner method within static method #871

@eric-milles

Description

@eric-milles

Consider the following:

static void meth() {
  new LinkedList() {
    @Override
    Object get(int i) {
      super.get(i)
    }
  }
}

Variable expression "super" is running into type inference error:

java.lang.NullPointerException
	at org.eclipse.jdt.groovy.search.VariableScope.lookupName(VariableScope.java:538)
	at org.eclipse.jdt.groovy.search.AbstractSimplifiedTypeLookup.getDeclaredVariable(AbstractSimplifiedTypeLookup.java:79)
	at org.eclipse.jdt.groovy.search.AbstractSimplifiedTypeLookup.lookupType(AbstractSimplifiedTypeLookup.java:122)
	at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.lookupExpressionType(TypeInferencingVisitorWithRequestor.java:2353)
	at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.handleSimpleExpression(TypeInferencingVisitorWithRequestor.java:1801)
	at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitVariableExpression(TypeInferencingVisitorWithRequestor.java:1699)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions