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 53294 Details for
Bug 163072
[search] method reference reports wrong potential matches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v01.txt (text/plain), 4.48 KB, created by
Frederic Fusier
on 2006-11-06 09:18:57 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2006-11-06 09:18:57 EST
Size:
4.48 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.282 >diff -u -r1.282 MatchLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 10 Oct 2006 10:33:17 -0000 1.282 >+++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 6 Nov 2006 12:03:52 -0000 >@@ -375,6 +375,12 @@ > throw e; // want to abort enclosing request to compile > } > } >+ // Display unit error in debug mode >+ if (BasicSearchEngine.VERBOSE) { >+ if (unitResult.problemCount > 0) { >+ System.out.println(unitResult); >+ } >+ } > } > /** > * Add additional source types >@@ -948,6 +954,10 @@ > this.lookupEnvironment = new LookupEnvironment(this, this.options, problemReporter, this.nameEnvironment); > > this.parser = MatchLocatorParser.createParser(problemReporter, this); >+ >+ // basic parser needs also to be reset as project options may have changed >+ // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=163072 >+ this.basicParser = null; > > // remember project's name lookup > this.nameLookup = searchableEnvironment.nameLookup; >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java,v >retrieving revision 1.37 >diff -u -r1.37 JavaSearchMultipleProjectsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java 7 Sep 2006 07:27:04 -0000 1.37 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java 6 Nov 2006 12:03:54 -0000 >@@ -793,4 +793,76 @@ > deleteProject("P2"); > } > } >+ >+/** >+ * @bug 163072: [search] method reference reports wrong potential matches >+ * @test Ensure that there's no potential match while searching in two projects having 1.4 and 1.5 compliances >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=163072" >+ */ >+public void testONLY_Bug163072() throws CoreException { >+ try { >+ // setup project P1 >+ /*IJavaProject p1 = */createJavaProject("P1"); // standard project using 1.4 compliance >+ createFolder("/P1/test"); >+ createFile( >+ "/P1/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public Object getType() {\n" + >+ " return null;\n" + >+ " }\n" + >+ " public void foo() {\n" + >+ " if (getType() == null) {\n" + >+ " System.out.println(\"null\");\n" + >+ " }\n" + >+ " }\n" + >+ "}\n" >+ ); >+ >+ // setup project P2 >+ createJavaProject("P2", new String[] {""}, new String[] {"JCL15_LIB"}, new String[] { "/P1" }, "", "1.5"); >+ createFolder("/P2/pack"); >+ createFile( >+ "/P2/pack/FactoryContainer.java", >+ "package pack;\n" + >+ "public class FactoryContainer {\n" + >+ " public enum FactoryType { PLUGIN }\n" + >+ " public FactoryType getType() {\n" + >+ " return FactoryType.PLUGIN;\n" + >+ " }\n" + >+ "}\n" >+ ); >+ createFile( >+ "/P2/pack/Reference.java", >+ "package pack;\n" + >+ "public class Reference {\n" + >+ " private final FactoryContainer _fc;\n" + >+ " public Reference() {\n" + >+ " _fc = new FactoryContainer();\n" + >+ " }\n" + >+ " boolean foo() {\n" + >+ " return _fc.getType() == FactoryContainer.FactoryType.PLUGIN;\n" + >+ " }\n" + >+ "}\n" >+ ); >+ >+ // Get method >+ IMethod method = getCompilationUnit("/P1/test/Test.java").getType("Test").getMethod("getType", new String[0]); >+ assertTrue("Method 'Test.getType()' should exist!", method.exists()); >+ >+ // search method declaration in workspace scope >+ IJavaSearchScope scope = SearchEngine.createWorkspaceScope(); //JavaSearchScope(new IJavaElement[] {p1, p2}); >+ JavaSearchResultCollector resultCollector = new JavaSearchResultCollector(); >+ resultCollector.showProject = true; >+ resultCollector.showAccuracy = true; >+ search(method, REFERENCES, scope, resultCollector); >+ assertSearchResults( >+ "Unexpected references of method Test.getType()", >+ "test/Test.java [in P1] void test.Test.foo() [getType()] EXACT_MATCH", >+ resultCollector); >+ } finally { >+ deleteProject("P1"); >+ deleteProject("P2"); >+ } >+} > }
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 163072
: 53294