Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 153434 Details for
Bug 288174
[search] NullPointerException when searching for type references
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v02.txt (text/plain), 3.87 KB, created by
Frederic Fusier
on 2009-12-01 05:38:50 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2009-12-01 05:38:50 EST
Size:
3.87 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java,v >retrieving revision 1.328 >diff -u -r1.328 MatchLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 6 Oct 2009 17:07:18 -0000 1.328 >+++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 1 Dec 2009 09:07:16 -0000 >@@ -463,7 +463,20 @@ > } > > // return binary method >- return createBinaryMethodHandle(type, method.selector, argumentTypeNames); >+ IMethod binaryMethod = createBinaryMethodHandle(type, method.selector, argumentTypeNames); >+ if (binaryMethod == null) { >+ // when first attempt fails, try with similar matches if any... >+ PossibleMatch similarMatch = this.currentPossibleMatch.getSimilarMatch(); >+ while (similarMatch != null) { >+ type = ((ClassFile)similarMatch.openable).getType(); >+ binaryMethod = createBinaryMethodHandle(type, method.selector, argumentTypeNames); >+ if (binaryMethod != null) { >+ return binaryMethod; >+ } >+ similarMatch = similarMatch.getSimilarMatch(); >+ } >+ } >+ return binaryMethod; > } > } > return null; >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java,v >retrieving revision 1.182 >diff -u -r1.182 JavaSearchBugsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 25 Nov 2009 12:26:50 -0000 1.182 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 1 Dec 2009 09:07:24 -0000 >@@ -11029,4 +11029,39 @@ > deleteProject("P"); > } > } >+ >+/** >+ * @bug 288174: NullPointerException when searching for type references >+ * @test Ensure that no NPE occurs when searching for type references >+ * when a binary type has matches in several member or anonymous types >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=288174" >+ */ >+public void testBug288174() throws Exception { >+ final String libPath = "/JavaSearchBugs/lib/b288174.jar"; >+ addLibraryEntry(JAVA_PROJECT, libPath, false); >+ try { >+ IPackageFragmentRoot root = getPackageFragmentRoot(libPath); >+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { root }); >+ search("*", TYPE, REFERENCES, scope); >+ assertSearchResults( >+ "lib/b288174.jar pack.<anonymous> EXACT_MATCH\n" + >+ "lib/b288174.jar E[] pack.<anonymous>.bar1(java.lang.Class<E>) EXACT_MATCH\n" + >+ "lib/b288174.jar E[] pack.<anonymous>.bar1(java.lang.Class<E>) EXACT_MATCH\n" + >+ "lib/b288174.jar E[] pack.<anonymous>.bar1(java.lang.Class<E>) EXACT_MATCH\n" + >+ "lib/b288174.jar E[] pack.<anonymous>.bar1(java.lang.Class<E>) EXACT_MATCH\n" + >+ "lib/b288174.jar E[] pack.<anonymous>.bar1(java.lang.Class<E>) EXACT_MATCH\n" + >+ "lib/b288174.jar void pack.Test.foo1() EXACT_MATCH\n" + >+ "lib/b288174.jar pack.<anonymous> EXACT_MATCH\n" + >+ "lib/b288174.jar F[] pack.<anonymous>.bar2(java.lang.Class<F>) EXACT_MATCH\n" + >+ "lib/b288174.jar F[] pack.<anonymous>.bar2(java.lang.Class<F>) EXACT_MATCH\n" + >+ "lib/b288174.jar F[] pack.<anonymous>.bar2(java.lang.Class<F>) EXACT_MATCH\n" + >+ "lib/b288174.jar F[] pack.<anonymous>.bar2(java.lang.Class<F>) EXACT_MATCH\n" + >+ "lib/b288174.jar F[] pack.<anonymous>.bar2(java.lang.Class<F>) EXACT_MATCH\n" + >+ "lib/b288174.jar void pack.Test.foo2() EXACT_MATCH" >+ ); >+ } >+ finally { >+ removeClasspathEntry(JAVA_PROJECT, new Path(libPath)); >+ } >+} > } >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 288174
: 153434 |
153437