Bug 14831 - NPE with hierarchy search of a local variable
Summary: NPE with hierarchy search of a local variable
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-29 08:32 EDT by Martin Möbius CLA
Modified: 2002-04-29 12:53 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Möbius CLA 2002-04-29 08:32:40 EDT
build 0425

I searched for references of a local variable within it's hierarchy

package test;

public class HierarchySearchTest {

	public HierarchySearchTest() {
		super();
	}
	
	private void test() {
		String local="";
		local="x";
	}

}

Select 2nd local and search hierarchy for references

!MESSAGE Internal Error
!STACK java.lang.reflect.InvocationTargetException: 
java.lang.NullPointerException
	at org.eclipse.jdt.internal.core.search.HierarchyScope.encloses
(HierarchyScope.java:159)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.report
(MatchLocator.java:714)
	at 
org.eclipse.jdt.internal.core.search.matching.SearchPattern.matchReportReference
(SearchPattern.java:1335)
	at 
org.eclipse.jdt.internal.core.search.matching.TypeReferencePattern.matchReportRe
ference(TypeReferencePattern.java:193)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportReference
(MatchLocator.java:1056)
	at org.eclipse.jdt.internal.core.search.matching.MatchSet.reportMatching
(MatchSet.java:261)
	at org.eclipse.jdt.internal.core.search.matching.MatchSet.reportMatching
(MatchSet.java:319)
	at org.eclipse.jdt.internal.core.search.matching.MatchSet.reportMatching
(MatchSet.java:246)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchingOpenable.locateMatchesInCo
mpilationUnit(MatchingOpenable.java:312)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchingOpenable.locateMatches
(MatchingOpenable.java:155)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:1322)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:591)
	at org.eclipse.jdt.core.search.SearchEngine.search
(SearchEngine.java:407)
	at org.eclipse.jdt.core.search.SearchEngine.search
(SearchEngine.java:353)
	at org.eclipse.jdt.internal.ui.search.JavaSearchOperation.execute
(JavaSearchOperation.java:82)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run
(WorkspaceModifyOperation.java:64)
	at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1342)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run
(WorkspaceModifyOperation.java:78)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run
(ModalContext.java:98)
Comment 1 Jerome Lanneluc CLA 2002-04-29 12:53:18 EDT
When trying to handle the working copy case, HierarchyScope was wrongly 
assuming that the type was in a compilation unit.

Fixed by protecting this case with a isBinary() check.