Skip to content

NPE in LocalDeclaration.resolve(LocalDeclaration.java:379) #5213

Description

@iloveeclipse
  1. Import JDT.UI project into the workspace and open org.eclipse.jdt.internal.ui.refactoring.reorg.ReorgMoveStarter in the editor.
  2. Right click on ReorgMoveStarter.create() method and try to "Open Call Hierarchy" on it.
  3. Call Hierarchy opens and shows no callers (there are some), at same time error is logged into the log, see below.
  4. Same happens with the "References -> Workspace" action. Searching for the ReorgMoveStarter type references works.
java.lang.NullPointerException: Cannot read field "id" because "variableType" is null
	at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:379)
	at org.eclipse.jdt.internal.compiler.ast.Statement.resolveWithBindings(Statement.java:526)
	at org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveStatements(ASTNode.java:699)
	at org.eclipse.jdt.internal.compiler.ast.Block.resolve(Block.java:143)
	at org.eclipse.jdt.internal.compiler.ast.Initializer.resolve(Initializer.java:149)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1395)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1610)
	at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:661)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process(MatchLocator.java:2055)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatchesDefaultImpl(MatchLocator.java:1364)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1283)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1401)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1522)
	at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:143)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:279)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:638)
	at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:697)
	at org.eclipse.jdt.internal.corext.callhierarchy.CallerMethodWrapper.findChildren(CallerMethodWrapper.java:167)
	at org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.performSearch(MethodWrapper.java:265)
	at org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.doFindChildren(MethodWrapper.java:196)
	at org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.getCalls(MethodWrapper.java:87)
	at org.eclipse.jdt.internal.ui.callhierarchy.DeferredMethodWrapper.getCalls(DeferredMethodWrapper.java:72)
	at org.eclipse.jdt.internal.ui.callhierarchy.DeferredMethodWrapper.lambda$0(DeferredMethodWrapper.java:80)
	at org.eclipse.jdt.core.JavaCore.lambda$1(JavaCore.java:6233)
	at org.eclipse.jdt.internal.core.JavaModelManager.cacheZipFiles(JavaModelManager.java:5752)
	at org.eclipse.jdt.internal.core.JavaModelManager.callReadOnly(JavaModelManager.java:5741)
	at org.eclipse.jdt.core.JavaCore.callReadOnly(JavaCore.java:6217)
	at org.eclipse.jdt.core.JavaCore.runReadOnly(JavaCore.java:6232)
	at org.eclipse.jdt.internal.ui.callhierarchy.DeferredMethodWrapper.fetchDeferredChildren(DeferredMethodWrapper.java:80)
	at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:215)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

I believe it could be regression from e49ba49 / #4164, where the code above the NPE changed the variableType assignments. @srikanth-sankaran : could you please check?

Metadata

Metadata

Labels

bugSomething isn't workingregressionSomething was broken by a previous change

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions