Bug 10386 - NPE in MatchLocator.lookupType
Summary: NPE in MatchLocator.lookupType
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P1 normal (vote)
Target Milestone: 2.0 M4   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 10340 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-02-27 09:33 EST by David Audel CLA
Modified: 2002-03-04 09:53 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2002-02-27 09:33:49 EST
1) create the following classes
-----------------------------------
public class X {

}

public class Z {
	public static int[] bar;
}

public class Y1 extends X {
	void foo() {
		int length = Z.bar.length;
	}
}

public class Y2 extends X {
	void foo() {
		int length = Z.bar.length;
	}
}
-------------------------------------
2) select Y1#foo in the ouliner
3) do rigth click and select Refactor->Pull Up
4) click on next

there is an error message in wizard

Stacktrace
java.lang.reflect.InvocationTargetException: java.lang.NullPointerException
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.lookupType
(MatchLocator.java:581)
	at 
org.eclipse.jdt.internal.core.search.matching.DeclarationOfAccessedFieldsPattern
.reportDeclaration(DeclarationOfAccessedFieldsPattern.java:79)
	at 
org.eclipse.jdt.internal.core.search.matching.DeclarationOfAccessedFieldsPattern
.matchReportReference(DeclarationOfAccessedFieldsPattern.java:69)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportReference
(MatchLocator.java:929)
	at org.eclipse.jdt.internal.core.search.matching.MatchSet.reportMatching
(MatchSet.java:161)
	at org.eclipse.jdt.internal.core.search.matching.MatchSet.reportMatching
(MatchSet.java:338)
	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:289)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchingOpenable.locateMatches
(MatchingOpenable.java:142)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:1182)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:509)
	at 
org.eclipse.jdt.core.search.SearchEngine.searchDeclarationsOfAccessedFields
(SearchEngine.java:571)
	at 
org.eclipse.jdt.internal.corext.refactoring.structure.ReferenceFinderUtil.getFie
ldReferencesIn(ReferenceFinderUtil.java:72)
	at 
org.eclipse.jdt.internal.corext.refactoring.structure.ReferenceFinderUtil.getFie
ldReferencesIn(ReferenceFinderUtil.java:64)
	at 
org.eclipse.jdt.internal.corext.refactoring.structure.ReferenceFinderUtil.getFie
ldsReferencedIn(ReferenceFinderUtil.java:55)
	at 
org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoring.checkAcc
essedFields(PullUpRefactoring.java:422)
	at 
org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoring.checkAcc
esses(PullUpRefactoring.java:394)
	at 
org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoring.checkInp
ut(PullUpRefactoring.java:300)
	at org.eclipse.jdt.internal.ui.refactoring.CheckConditionsOperation.run
(CheckConditionsOperation.java:58)
	at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run
(CreateChangeOperation.java:93)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run
(ModalContext.java:98)
Comment 1 Jerome Lanneluc CLA 2002-02-28 07:45:34 EST
The 'length' field was treated as a regular field. But it has a null 
declararing class.
Fixed by explicitely checking for this case.
Comment 2 Jerome Lanneluc CLA 2002-03-04 09:53:01 EST
*** Bug 10340 has been marked as a duplicate of this bug. ***