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 156098 Details for
Bug 295894
[search] Search shows focus type implementation for nested types even though the scope is restricted to subtypes.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
same patch - one more test
bug_295894_patch6.txt (text/plain), 6.15 KB, created by
Stephan Herrmann
on 2010-01-14 09:12:05 EST
(
hide
)
Description:
same patch - one more test
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2010-01-14 09:12:05 EST
Size:
6.15 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: search/org/eclipse/jdt/internal/core/search/HierarchyScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/HierarchyScope.java,v >retrieving revision 1.48 >diff -u -r1.48 HierarchyScope.java >--- search/org/eclipse/jdt/internal/core/search/HierarchyScope.java 13 Jan 2010 17:38:20 -0000 1.48 >+++ search/org/eclipse/jdt/internal/core/search/HierarchyScope.java 14 Jan 2010 13:52:04 -0000 >@@ -128,6 +128,11 @@ > IType[] types = null; > if (this.subTypes != null) { > types = this.hierarchy.getAllSubtypes(this.focusType); >+ if (this.includeFocusType) { >+ int len = types.length; >+ System.arraycopy(types, 0, types=new IType[len+1], 0, len); >+ types[len] = this.focusType; >+ } > } else { > types = this.hierarchy.getAllTypes(); > } >#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.189 >diff -u -r1.189 JavaSearchBugsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 13 Jan 2010 17:38:24 -0000 1.189 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 14 Jan 2010 13:52:25 -0000 >@@ -11137,6 +11137,167 @@ > } > > /** >+ * @bug 295894: Search shows focus type implementation for nested types even though the scope is restricted to subtypes. >+ * @test explicitly including the focus type, which has no subtypes. >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=295894" >+ */ >+public void testBug295894c() throws Exception { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/A.java", >+ "public class A {\n" + >+ " void test() {\n" + >+ " A a= new A();\n" + >+ " a.toString();\n" + >+ " }\n" + >+ " @Override\n" + >+ " public String toString() {\n" + >+ " return \"\";\n" + >+ " }\n" + >+ "}\n" + >+ "" >+ ); >+ search( >+ "toString", >+ METHOD, >+ DECLARATIONS, >+ SearchEngine.createStrictHierarchyScope(null, this.workingCopies[0].findPrimaryType(), true, true, null), >+ this.resultCollector); >+ assertSearchResults( >+ "src/A.java String A.toString() [toString] EXACT_MATCH" >+ ); >+} >+//Failing test while working with a compilation unit instead of working copy >+public void testBug295894c2() throws Exception { >+ try { >+ createJavaProject("P"); >+ createFile( >+ "/P/A.java", >+ "public class A {\n" + >+ " void test() {\n" + >+ " A a= new A();\n" + >+ " a.toString();\n" + >+ " }\n" + >+ " @Override\n" + >+ " public String toString() {\n" + >+ " return \"\";\n" + >+ " }\n" + >+ "}\n" >+ ); >+ final ICompilationUnit cu = getCompilationUnit("/P/A.java"); >+ IMethod method = selectMethod(cu, "toString"); >+ search(method, >+ DECLARATIONS|IGNORE_RETURN_TYPE, >+ SearchEngine.createStrictHierarchyScope(null, cu.findPrimaryType(), true, true, null), >+ this.resultCollector); >+ assertSearchResults( >+ "A.java String A.toString() [toString] EXACT_MATCH" >+ ); >+ } >+ finally { >+ deleteProject("P"); >+ } >+} >+// Similar test passing when the focus type has a subclass >+public void testBug295894c3() throws Exception { >+ try { >+ createJavaProject("P"); >+ createFile( >+ "/P/A.java", >+ "public class A {\n" + >+ " void test() {\n" + >+ " A a= new A();\n" + >+ " a.toString();\n" + >+ " }\n" + >+ " @Override\n" + >+ " public String toString() {\n" + >+ " return \"\";\n" + >+ " }\n" + >+ "}\n" + >+ "class B extends A {\n" + >+ "}\n" >+ ); >+ final ICompilationUnit cu = getCompilationUnit("/P/A.java"); >+ IMethod method = selectMethod(cu, "toString"); >+ search(method, >+ DECLARATIONS|IGNORE_RETURN_TYPE, >+ SearchEngine.createStrictHierarchyScope(null, cu.findPrimaryType(), true, true, null), >+ this.resultCollector); >+ assertSearchResults( >+ "A.java String A.toString() [toString] EXACT_MATCH" >+ ); >+ } >+ finally { >+ deleteProject("P"); >+ } >+} >+// similar test using older API in SearchEngine: >+public void testBug295894c4() throws Exception { >+ try { >+ createJavaProject("P"); >+ createFile( >+ "/P/A.java", >+ "public class A {\n" + >+ " void test() {\n" + >+ " A a= new A();\n" + >+ " a.toString();\n" + >+ " }\n" + >+ " @Override\n" + >+ " public String toString() {\n" + >+ " return \"\";\n" + >+ " }\n" + >+ "}\n" >+ ); >+ final ICompilationUnit cu = getCompilationUnit("/P/A.java"); >+ IMethod method = selectMethod(cu, "toString"); >+ search(method, >+ DECLARATIONS|IGNORE_RETURN_TYPE, >+ SearchEngine.createHierarchyScope(cu.findPrimaryType(), null), >+ this.resultCollector); >+ assertSearchResults( >+ "A.java String A.toString() [toString] EXACT_MATCH" >+ ); >+ } >+ finally { >+ deleteProject("P"); >+ } >+} >+//Similar test to testBug295894c3 but using separate files for types >+public void testBug295894c5() throws Exception { >+ try { >+ createJavaProject("P"); >+ createFile( >+ "/P/A.java", >+ "public class A {\n" + >+ " void test() {\n" + >+ " A a= new A();\n" + >+ " a.toString();\n" + >+ " }\n" + >+ " @Override\n" + >+ " public String toString() {\n" + >+ " return \"\";\n" + >+ " }\n" + >+ "}" >+ ); >+ createFile( >+ "/P/B.java", >+ "class B extends A {\n" + >+ "}\n" >+ ); >+ final ICompilationUnit cu = getCompilationUnit("/P/A.java"); >+ IMethod method = selectMethod(cu, "toString"); >+ search(method, >+ DECLARATIONS|IGNORE_RETURN_TYPE, >+ SearchEngine.createStrictHierarchyScope(null, cu.findPrimaryType(), true, true, null), >+ this.resultCollector); >+ assertSearchResults( >+ "A.java String A.toString() [toString] EXACT_MATCH" >+ ); >+ } >+ finally { >+ 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
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
Flags:
frederic_fusier
:
iplog+
frederic_fusier
:
review+
Actions:
View
|
Diff
Attachments on
bug 295894
:
152929
|
152945
|
153058
|
153865
|
153938
|
155994
|
156008
|
156074
|
156084
|
156088
|
156091
| 156098