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 48022 Details for
Bug 151189
[search] Declaration search does not find all matches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v00.txt (text/plain), 8.15 KB, created by
Frederic Fusier
on 2006-08-16 11:22:02 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2006-08-16 11:22:02 EDT
Size:
8.15 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: buildnotes_jdt-core.html >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/buildnotes_jdt-core.html,v >retrieving revision 1.5373 >diff -u -r1.5373 buildnotes_jdt-core.html >--- buildnotes_jdt-core.html 15 Aug 2006 16:03:50 -0000 1.5373 >+++ buildnotes_jdt-core.html 16 Aug 2006 15:16:08 -0000 >@@ -75,7 +75,9 @@ > </ul> > > <h3>Problem Reports Fixed</h3> >-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=148224">148224</a> >+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=151189">151189</a> >+[search] Declaration search does not find all matches >+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=148224">148224</a> > AST API request: have binding for int, need int[], int[][] .... > > <a name="v_709"></a> >Index: search/org/eclipse/jdt/internal/core/search/IndexSelector.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java,v >retrieving revision 1.34 >diff -u -r1.34 IndexSelector.java >--- search/org/eclipse/jdt/internal/core/search/IndexSelector.java 13 Jun 2006 13:00:43 -0000 1.34 >+++ search/org/eclipse/jdt/internal/core/search/IndexSelector.java 16 Aug 2006 15:16:08 -0000 >@@ -123,7 +123,7 @@ > IndexManager manager = JavaModelManager.getJavaModelManager().getIndexManager(); > SimpleSet locations = new SimpleSet(); > IJavaElement focus = MatchLocator.projectOrJarFocus(this.pattern); >- if (focus == null) { >+ if (focus == null || this.searchScope instanceof JavaWorkspaceScope) { > for (int i = 0; i < projectsAndJars.length; i++) > locations.add(manager.computeIndexLocation(projectsAndJars[i])); > } else { >@@ -157,12 +157,18 @@ > IClasspathEntry[] entries = projectsCanSeeFocus[i].getResolvedClasspath(); > for (int j = entries.length; --j >= 0;) { > IClasspathEntry entry = entries[j]; >- if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { >- IPath path = entry.getPath(); >- if (jarsToCheck.includes(path)) { >+ switch (entry.getEntryKind()) { >+ case IClasspathEntry.CPE_LIBRARY: >+ IPath path = entry.getPath(); >+ if (jarsToCheck.includes(path)) { >+ locations.add(manager.computeIndexLocation(entry.getPath())); >+ jarsToCheck.remove(path); >+ } >+ break; >+ case IClasspathEntry.CPE_PROJECT: >+ // add required projects to index locations > locations.add(manager.computeIndexLocation(entry.getPath())); >- jarsToCheck.remove(path); >- } >+ break; > } > } > } >#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.36 >diff -u -r1.36 JavaSearchMultipleProjectsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java 13 Jun 2006 13:01:06 -0000 1.36 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java 16 Aug 2006 15:16:15 -0000 >@@ -24,6 +24,7 @@ > * Tests the Java search engine accross multiple projects. > */ > public class JavaSearchMultipleProjectsTests extends ModifyingResourceTests implements IJavaSearchConstants { >+ private final static int UI_DECLARATIONS = DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE; > public JavaSearchMultipleProjectsTests(String name) { > super(name); > } >@@ -664,4 +665,132 @@ > deleteProject("P2"); > } > } >+ >+/** >+ * Bug 151189: [search] Declaration search does not find all matches >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=151189" >+ */ >+public void testBug151189_Workspace() throws CoreException { >+ try { >+ // setup project P1 >+ /*IJavaProject p1 = */createJavaProject("P1"); >+ createFolder("/P1/pack"); >+ createFile( >+ "/P1/pack/Declaration.java", >+ "package pack;\n" + >+ "public class Declaration implements Interface {\n" + >+ " public void doOperation(int val) {}\n" + >+ "}\n" >+ ); >+ createFile( >+ "/P1/pack/Interface.java", >+ "package pack;\n" + >+ "public interface Interface {\n" + >+ " void doOperation(int val);\n" + >+ "}\n" >+ ); >+ >+ // setup project P2 >+ createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, new String[] { "/P1" }, ""); >+ createFolder("/P2/test"); >+ createFile( >+ "/P2/test/Declaration_bis.java", >+ "package test;\n" + >+ "import pack.Interface;\n" + >+ "public class Declaration_bis implements Interface {\n" + >+ " public void doOperation(int val) {}\n" + >+ "}\n" >+ ); >+ >+ // Get method >+ IMethod method = getCompilationUnit("/P2/test/Declaration_bis.java").getType("Declaration_bis").getMethod("doOperation", new String[] {"I"}); >+ >+ // search method declaration in workspace scope >+ IJavaSearchScope scope = SearchEngine.createWorkspaceScope(); //JavaSearchScope(new IJavaElement[] {p1, p2}); >+ JavaSearchResultCollector resultCollector = new JavaSearchResultCollector(); >+ resultCollector.showProject = true; >+ search( >+ method, >+ DECLARATIONS, >+ scope, >+ resultCollector); >+ assertSearchResults( >+ "Unexpected declarations of method test.Declaration_bis.doOperation(int)", >+ "test/Declaration_bis.java [in P2] void test.Declaration_bis.doOperation(int) [doOperation]", >+ resultCollector); >+ >+ // search method declaration in workspace scope with JDT-UI flags >+ resultCollector = new JavaSearchResultCollector(); >+ resultCollector.showProject = true; >+ search( >+ method, >+ UI_DECLARATIONS, >+ scope, >+ resultCollector); >+ assertSearchResults( >+ "Unexpected declarations of method test.Declaration_bis.doOperation(int)", >+ "pack/Declaration.java [in P1] void pack.Declaration.doOperation(int) [doOperation]\n" + >+ "pack/Interface.java [in P1] void pack.Interface.doOperation(int) [doOperation]\n" + >+ "test/Declaration_bis.java [in P2] void test.Declaration_bis.doOperation(int) [doOperation]", >+ resultCollector); >+ } finally { >+ deleteProject("P1"); >+ deleteProject("P2"); >+ } >+} >+public void testBug151189_Project() throws CoreException { >+ try { >+ // setup project P1 >+ createJavaProject("P1"); >+ createFolder("/P1/pack"); >+ createFile( >+ "/P1/pack/Declaration.java", >+ "package pack;\n" + >+ "public class Declaration implements Interface {\n" + >+ " public void doOperation(int val) {}\n" + >+ "}\n" >+ ); >+ createFile( >+ "/P1/pack/Interface.java", >+ "package pack;\n" + >+ "public interface Interface {\n" + >+ " void doOperation(int val);\n" + >+ "}\n" >+ ); >+ >+ // setup project P2 >+ IJavaProject p2 = createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB"}, new String[] { "/P1" }, ""); >+ createFolder("/P2/test"); >+ createFile( >+ "/P2/test/Declaration_bis.java", >+ "package test;\n" + >+ "import pack.Interface;\n" + >+ "public class Declaration_bis implements Interface {\n" + >+ " public void doOperation(int val) {}\n" + >+ "}\n" >+ ); >+ >+ // Get method >+ IMethod method = getCompilationUnit("/P2/test/Declaration_bis.java").getType("Declaration_bis").getMethod("doOperation", new String[] {"I"}); >+ >+ // search method declaration in workspace scope >+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {p2}); >+ JavaSearchResultCollector resultCollector = new JavaSearchResultCollector(); >+ resultCollector.showProject = true; >+ search( >+ method, >+ UI_DECLARATIONS, >+ scope, >+ resultCollector); >+ assertSearchResults( >+ "Unexpected declarations of method test.Declaration_bis.doOperation(int)", >+ "pack/Declaration.java [in P1] void pack.Declaration.doOperation(int) [doOperation]\n" + >+ "pack/Interface.java [in P1] void pack.Interface.doOperation(int) [doOperation]\n" + >+ "test/Declaration_bis.java [in P2] void test.Declaration_bis.doOperation(int) [doOperation]", >+ 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 151189
:
48022
|
49583