Community
Participate
Working Groups
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)
The 'length' field was treated as a regular field. But it has a null declararing class. Fixed by explicitely checking for this case.
*** Bug 10340 has been marked as a duplicate of this bug. ***