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 56845 Details for
Bug 144044
[search] NPE when trying to find references to field variable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v00.txt (text/plain), 4.04 KB, created by
Frederic Fusier
on 2007-01-12 14:20:17 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2007-01-12 14:20:17 EST
Size:
4.04 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java,v >retrieving revision 1.42 >diff -u -r1.42 FieldLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java 10 May 2006 18:03:42 -0000 1.42 >+++ search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java 12 Jan 2007 19:08:19 -0000 >@@ -218,10 +218,10 @@ > break; > case INACCURATE_MATCH: > match = locator.newFieldReferenceMatch(element, elementBinding, SearchMatch.A_INACCURATE, -1, -1, reference); >- if (otherBinding.type.isParameterizedType() && this.pattern.hasTypeArguments()) { >+ if (otherBinding.type != null && otherBinding.type.isParameterizedType() && this.pattern.hasTypeArguments()) { > updateMatch((ParameterizedTypeBinding) otherBinding.type, this.pattern.getTypeArguments(), locator); > } >- matches[indexOfFirstFieldBinding] = match; >+ matches[i] = match; > break; > } > } >#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.97 >diff -u -r1.97 JavaSearchBugsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 17 Dec 2006 17:18:44 -0000 1.97 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 12 Jan 2007 19:08:50 -0000 >@@ -6806,6 +6806,72 @@ > } > > /** >+ * Bug 144044: [search] NPE when trying to find references to field variable >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=144044" >+ */ >+public void testBug144044() throws CoreException { >+ workingCopies = new ICompilationUnit[2]; >+ workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/test1/p/Test.java", >+ "package test1.p;\n" + >+ "import test1.q.X;\n" + >+ "public class Test {\n" + >+ " String foo(X val) {\n" + >+ " return val.str;\n" + >+ " }\n" + >+ "}\n" >+ ); >+ workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/test1/q/X.java", >+ "package test1.q;\n" + >+ "public class X {\n" + >+ " String str;\n" + >+ "}\n" >+ ); >+ IType type = this.workingCopies[1].getType("X"); >+ IField field = type.getField("str"); >+ search(field, REFERENCES); >+ assertSearchResults( >+ "src/test1/p/Test.java String test1.p.Test.foo(X) [str] POTENTIAL_MATCH" >+ ); >+} >+public void testBug144044b() throws CoreException { >+ workingCopies = new ICompilationUnit[4]; >+ workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/test2/p/Test.java", >+ "package test2.p;\n" + >+ "import test2.q.X;\n" + >+ "public class Test {\n" + >+ " X foo() {\n" + >+ " return X.y_field.z_field.x_field.y_field.z_field.x_field;\n" + >+ " }\n" + >+ "}\n" >+ ); >+ workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/test2/q/X.java", >+ "package test2.q;\n" + >+ "public class X {\n" + >+ " public static Y y_field;\n" + >+ "}\n" >+ ); >+ workingCopies[2] = getWorkingCopy("/JavaSearchBugs/src/test2/q/Y.java", >+ "package test2.q;\n" + >+ "public class Y {\n" + >+ " public static Z z_field;\n" + >+ "}\n" >+ ); >+ workingCopies[3] = getWorkingCopy("/JavaSearchBugs/src/test2/q/Z.java", >+ "package test2.q;\n" + >+ "public class Z {\n" + >+ " static X x_field;\n" + >+ "}\n" >+ ); >+ IType type = this.workingCopies[3].getType("Z"); >+ IField field = type.getField("x_field"); >+ search(field, REFERENCES); >+ assertSearchResults( >+ "src/test2/p/Test.java X test2.p.Test.foo() [x_field] POTENTIAL_MATCH\n" + >+ "src/test2/p/Test.java X test2.p.Test.foo() [x_field] POTENTIAL_MATCH" >+ ); >+} >+ >+/** > * Bug 148215: [search] correct results are missing in java search > * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=148215" > */
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 144044
: 56845