Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 189782

Summary: NPE in SourceTypeBinding.resolveTypesFor
Product: [Eclipse Project] JDT Reporter: John Arthorne <john.arthorne>
Component: CoreAssignee: Satyam Kandula <satyam.kandula>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, byron, Olivier_Thomann, srikanth_sankaran
Version: 3.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard: stalebug

Description John Arthorne CLA 2007-05-29 16:51:26 EDT
Build: I20070529-0010

org.eclipse.core.tools plugin has a utility called "Find Unreferenced Members" that walks over a java project/package/class, and searches for references to each method and field. When I run this on org.eclipse.core.resources, I get about 6 of the following stack traces in my log. Here is the steps:

1) Checkout org.eclipse.core.tools from HEAD
2) Use PDE export to create a binary plugin.
3) Shutdown, install the new plugin, restart with -clean
4) Checkout org.eclipse.core.resources from HEAD
5) Right click on project, "Find Unreferenced Members" from context menu

Here is the stack:

!ENTRY org.eclipse.jdt.core 4 4 2007-05-29 16:26:50.916
!MESSAGE Could not retrieve declared methods
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesFor(SourceTypeBinding.java(Compiled Code))
	at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.methods(SourceTypeBinding.java(Compiled Code))
	at org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.availableMethods(ReferenceBinding.java:174)
	at org.eclipse.jdt.core.dom.TypeBinding.getDeclaredMethods(TypeBinding.java(Compiled Code))
	at org.eclipse.jdt.internal.corext.dom.Bindings.findOverriddenMethodInType(Bindings.java(Compiled Code))
	at org.eclipse.jdt.internal.corext.dom.Bindings.findOverriddenMethodInHierarchy(Bindings.java:441)
	at org.eclipse.jdt.internal.corext.dom.Bindings.findOverriddenMethodInHierarchy(Bindings.java:452)
	at org.eclipse.jdt.internal.corext.dom.Bindings.findOverriddenMethod(Bindings.java:475)
	at org.eclipse.core.tools.search.FindUnusedMembers.methodOverrides(FindUnusedMembers.java:124)
	at org.eclipse.core.tools.search.FindUnusedMembers.doSearchType(FindUnusedMembers.java:139)
	at org.eclipse.core.tools.search.FindUnusedMembers.doSearchCU(FindUnusedMembers.java:116)
	at org.eclipse.core.tools.search.FindUnusedMembers.process(FindUnusedMembers.java:207)
	at org.eclipse.core.tools.search.FindUnusedSearchQuery.run(FindUnusedSearchQuery.java:68)
	at org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:94)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Comment 1 John Arthorne CLA 2007-05-29 16:54:39 EDT
I just noticed that it's using an internal class (Martin actually contributed this). Feel free to mark invalid if I'm doing something illegal here.
Comment 2 Olivier Thomann CLA 2007-05-29 22:04:35 EDT
This is another case when walking the binding hierarchy and trying to resolve more bindings that were not resolved before the scopes were flushed.
Comment 3 Philipe Mulet CLA 2007-05-30 07:25:19 EDT
Olivier - isn't this a case where the scopes shouldn't have been flushed already ? (i.e. not resetting the context)
Comment 4 Olivier Thomann CLA 2007-05-30 11:00:04 EDT
I guess yes. The scope should still be there for further resolution, but this is not the case.
Comment 5 Olivier Thomann CLA 2010-11-09 09:38:59 EST
Satyam, this might be related to your actual investigation of improving binding handling.
Comment 6 Satyam Kandula CLA 2010-11-11 06:33:53 EST
This still fails with my current implementation too. We should probably process the CU when we run into this mode. Need to find if we could safely do this. Do you have any other ideas?
Comment 7 Satyam Kandula CLA 2011-09-30 07:10:39 EDT
*** Bug 359478 has been marked as a duplicate of this bug. ***
Comment 8 Satyam Kandula CLA 2012-03-06 06:25:01 EST
*** Bug 359478 has been marked as a duplicate of this bug. ***
Comment 9 Eclipse Genie CLA 2020-03-07 17:37:06 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.