View | Details | Raw Unified | Return to bug 295894 | Differences between
and this patch

Collapse All | Expand All

(-)search/org/eclipse/jdt/core/search/SearchEngine.java (-9 / +10 lines)
Lines 193-221 Link Here
193
	 * The Java elements resulting from a search with this scope will be types in this hierarchy,
193
	 * The Java elements resulting from a search with this scope will be types in this hierarchy,
194
	 * or members or enclosing types of the types in this hierarchy.
194
	 * or members or enclosing types of the types in this hierarchy.
195
	 * <p>
195
	 * <p>
196
	 * By default, hierarchy scopes include all direct and indirect supertypes and subtypes of the
196
	 * Unlike the other <code>createHierarchyScope</code> methods, this method creates
197
	 * focus type. This method, however, allows to restrict the hierarchy to true subtypes,
197
	 * scopes that only contain types that actually span the hierarchy of the focus
198
	 * neither including supertypes nor the focus type itself.
198
	 * type, but do not include additional enclosing or member types.
199
	 * </p>
199
	 * </p>
200
	 * <p>
200
	 * <p>
201
	 * By default, hierarchy scopes include also member types and enclosing types of those types
201
	 * By default, hierarchy scopes include all direct and indirect supertypes and subtypes of the
202
	 * that actually span the hierarchy. This method, however, allows to inhibit this behavior,
202
	 * focus type. This method, however, allows to restrict the hierarchy to true subtypes,
203
	 * by passing <code>true</code> to the parameter <code>noMemberTypes</code>.
203
	 * not including supertypes. Also inclusion of the focus type itself is controled by a parameter. 
204
	 * </p>
204
	 * </p>
205
	 * 
205
	 * 
206
	 * @param project the project to which to constrain the search, or <code>null</code> if
206
	 * @param project the project to which to constrain the search, or <code>null</code> if
207
	 *        search should consider all types in the workspace 
207
	 *        search should consider all types in the workspace 
208
	 * @param type the focus of the hierarchy scope
208
	 * @param type the focus of the hierarchy scope
209
	 * @param onlySubtypes if true only subtypes of <code>type</code> are considered
209
	 * @param onlySubtypes if true only subtypes of <code>type</code> are considered
210
	 * @param noMemberTypes if true do not consider member or enclosing types of types in the given type hiearchy
210
	 * @param includeFocusType if true the focus type <code>type</code> is included in the resulting scope, 
211
	 * 		  otherwise it is excluded
211
	 * @param owner the owner of working copies that take precedence over original compilation units, 
212
	 * @param owner the owner of working copies that take precedence over original compilation units, 
212
	 *        or <code>null</code> if the primary working copy owner should be used
213
	 *        or <code>null</code> if the primary working copy owner should be used
213
	 * @return a new hierarchy scope
214
	 * @return a new hierarchy scope
214
	 * @exception JavaModelException if the hierarchy could not be computed on the given type
215
	 * @exception JavaModelException if the hierarchy could not be computed on the given type
215
	 * @since 3.6
216
	 * @since 3.6
216
	 */
217
	 */
217
	public static IJavaSearchScope createHierarchyScope(IJavaProject project, IType type, boolean onlySubtypes, boolean noMemberTypes, WorkingCopyOwner owner) throws JavaModelException {
218
	public static IJavaSearchScope createHierarchyScope(IJavaProject project, IType type, boolean onlySubtypes, boolean includeFocusType, WorkingCopyOwner owner) throws JavaModelException {
218
		return BasicSearchEngine.createHierarchyScope(project, type, onlySubtypes, noMemberTypes, owner);
219
		return BasicSearchEngine.createHierarchyScope(project, type, onlySubtypes, includeFocusType, owner);
219
	}
220
	}
220
221
221
	/**
222
	/**
(-)search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java (-2 / +2 lines)
Lines 111-118 Link Here
111
	/**
111
	/**
112
	 * @see SearchEngine#createHierarchyScope(IJavaProject,IType,boolean,boolean,WorkingCopyOwner) for detailed comment.
112
	 * @see SearchEngine#createHierarchyScope(IJavaProject,IType,boolean,boolean,WorkingCopyOwner) for detailed comment.
113
	 */
113
	 */
114
	public static IJavaSearchScope createHierarchyScope(IJavaProject project, IType type, boolean onlySubtypes, boolean noMemberTypes, WorkingCopyOwner owner) throws JavaModelException {
114
	public static IJavaSearchScope createHierarchyScope(IJavaProject project, IType type, boolean onlySubtypes, boolean includeFocusType, WorkingCopyOwner owner) throws JavaModelException {
115
		return new HierarchyScope(project, type, owner, onlySubtypes, noMemberTypes);
115
		return new HierarchyScope(project, type, owner, onlySubtypes, includeFocusType);
116
	}
116
	}
117
117
118
	/**
118
	/**
(-)search/org/eclipse/jdt/internal/core/search/HierarchyScope.java (-5 / +12 lines)
Lines 44-49 Link Here
44
	private HashSet subTypes = null; // null means: don't filter for subTypes
44
	private HashSet subTypes = null; // null means: don't filter for subTypes
45
	private IJavaProject javaProject = null; // null means: don't constrain the search to a project
45
	private IJavaProject javaProject = null; // null means: don't constrain the search to a project
46
	private boolean allowMemberTypes = true;
46
	private boolean allowMemberTypes = true;
47
	private boolean includeFocusType = true;
47
48
48
	/* (non-Javadoc)
49
	/* (non-Javadoc)
49
	 * Adds the given resource to this search scope.
50
	 * Adds the given resource to this search scope.
Lines 62-82 Link Here
62
63
63
	/**
64
	/**
64
	 * Creates a new hierarchy scope for the given type.
65
	 * Creates a new hierarchy scope for the given type.
66
	 * Unlike the other constructor, this constructor creates scopes that only contain types
67
	 * that actually span the hierarchy of the focus type, but do not include additional
68
	 * enclosing or member types.
65
	 * @param project      constrain the search result to this project, 
69
	 * @param project      constrain the search result to this project, 
66
	 *                     or <code>null</code> if search should consider all types in the workspace 
70
	 *                     or <code>null</code> if search should consider all types in the workspace 
67
	 * @param type         the focus type of the hierarchy
71
	 * @param type         the focus type of the hierarchy
68
	 * @param owner 	   the owner of working copies that take precedence over original compilation units, 
72
	 * @param owner 	   the owner of working copies that take precedence over original compilation units, 
69
	 *                     or <code>null</code> if the primary working copy owner should be used
73
	 *                     or <code>null</code> if the primary working copy owner should be used
70
	 * @param onlySubtypes if true search only subtypes of 'type' (not including 'type')
74
	 * @param onlySubtypes if true search only subtypes of 'type'
71
	 * @param noMemberTypes if true do not consider member or enclosing types of types in the given type hierarchy.
75
	 * @param includeFocusType if true the focus type <code>type</code> is included in the resulting scope, otherwise it is excluded
72
	 */
76
	 */
73
	public HierarchyScope(IJavaProject project, IType type, WorkingCopyOwner owner, boolean onlySubtypes, boolean noMemberTypes) throws JavaModelException {
77
	public HierarchyScope(IJavaProject project, IType type, WorkingCopyOwner owner, boolean onlySubtypes, boolean includeFocusType) throws JavaModelException {
74
		this(type, owner);
78
		this(type, owner);
75
		this.javaProject = project;
79
		this.javaProject = project;
76
		if (onlySubtypes) {
80
		if (onlySubtypes) {
77
			this.subTypes = new HashSet();
81
			this.subTypes = new HashSet();
78
		}
82
		}
79
		this.allowMemberTypes = !noMemberTypes;
83
		this.includeFocusType = includeFocusType;
84
		this.allowMemberTypes = false;
80
	}
85
	}
81
86
82
	/* (non-Javadoc)
87
	/* (non-Javadoc)
Lines 302-308 Link Here
302
	 */
307
	 */
303
	public boolean encloses(IJavaElement element) {
308
	public boolean encloses(IJavaElement element) {
304
		if (this.hierarchy == null) {
309
		if (this.hierarchy == null) {
305
			if (this.subTypes == null && this.focusType.equals(element.getAncestor(IJavaElement.TYPE))) {
310
			if (this.includeFocusType && this.focusType.equals(element.getAncestor(IJavaElement.TYPE))) {
306
				return true;
311
				return true;
307
			} else {
312
			} else {
308
				if (this.needsRefresh) {
313
				if (this.needsRefresh) {
Lines 332-337 Link Here
332
			type = ((IMember) element).getDeclaringType();
337
			type = ((IMember) element).getDeclaringType();
333
		}
338
		}
334
		if (type != null) {
339
		if (type != null) {
340
			if (this.focusType.equals(type))
341
				return this.includeFocusType;
335
			// potentially allow travelling in:
342
			// potentially allow travelling in:
336
			if (enclosesType(type, this.allowMemberTypes)) {
343
			if (enclosesType(type, this.allowMemberTypes)) {
337
				return true;
344
				return true;
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java (+99 lines)
Lines 11064-11067 Link Here
11064
		removeClasspathEntry(JAVA_PROJECT, new Path(libPath));
11064
		removeClasspathEntry(JAVA_PROJECT, new Path(libPath));
11065
	}
11065
	}
11066
}
11066
}
11067
11068
static { TESTS_PREFIX = "testBug295894"; }
11069
/**
11070
 * @bug 295894: Search shows focus type implementation for nested types even though the scope is restricted to subtypes.
11071
 * @test using the hierarchy with the old API includes the focus type. 
11072
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=295894"
11073
 */
11074
public void testBug295894() throws Exception {
11075
	this.workingCopies = new ICompilationUnit[1];
11076
	this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
11077
		"public class Test {\n" + 
11078
		"    void test() {\n" + 
11079
		"        Test t = new Test();\n" + 
11080
		"        t.foo();\n" + 
11081
		"    }\n" + 
11082
		"    public void foo() {\n" + 
11083
		"    }\n" + 
11084
		"    public class Sub extends Test {\n" + 
11085
		"        public void foo() {}\n" + 
11086
		"    }\n" + 
11087
		"}\n" + 
11088
		""
11089
	);
11090
	search(
11091
		"foo",
11092
		METHOD,
11093
		DECLARATIONS,
11094
		SearchEngine.createHierarchyScope(this.workingCopies[0].findPrimaryType()),
11095
		this.resultCollector);
11096
	assertSearchResults(
11097
		"src/Test.java void Test.foo() [foo] EXACT_MATCH\n" + 
11098
		"src/Test.java void Test$Sub.foo() [foo] EXACT_MATCH"
11099
	);
11100
}
11101
/**
11102
 * @bug 295894: Search shows focus type implementation for nested types even though the scope is restricted to subtypes.
11103
 * @test when restricting the hierarchy to sub types the focus should not be included 
11104
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=295894"
11105
 */
11106
public void testBug295894a() throws Exception {
11107
	this.workingCopies = new ICompilationUnit[1];
11108
	this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
11109
		"public class Test {\n" + 
11110
		"    void test() {\n" + 
11111
		"        Test t = new Test();\n" + 
11112
		"        t.foo();\n" + 
11113
		"    }\n" + 
11114
		"    public void foo() {\n" + 
11115
		"    }\n" + 
11116
		"    public class Sub extends Test {\n" + 
11117
		"        public void foo() {}\n" + 
11118
		"    }\n" + 
11119
		"}\n" + 
11120
		""
11121
	);
11122
	search(
11123
		"foo",
11124
		METHOD,
11125
		DECLARATIONS,
11126
		SearchEngine.createHierarchyScope(null, this.workingCopies[0].findPrimaryType(), true, false, null),
11127
		this.resultCollector);
11128
	// Test$Sub is a true sub type, not affected by filtering member types
11129
	assertSearchResults(
11130
		"src/Test.java void Test$Sub.foo() [foo] EXACT_MATCH"
11131
	);
11132
}
11133
/**
11134
 * @bug 295894: Search shows focus type implementation for nested types even though the scope is restricted to subtypes.
11135
 * @test when not restricting the hierarchy to sub types the focus should be included 
11136
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=295894"
11137
 */
11138
public void testBug295894b() throws Exception {
11139
	this.workingCopies = new ICompilationUnit[1];
11140
	this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
11141
		"public class Test {\n" + 
11142
		"    void test() {\n" + 
11143
		"        Test t = new Test();\n" + 
11144
		"        t.foo();\n" + 
11145
		"    }\n" + 
11146
		"    public void foo() {\n" + 
11147
		"    }\n" + 
11148
		"    public class Sub extends Test {\n" + 
11149
		"        public void foo() {}\n" + 
11150
		"    }\n" + 
11151
		"}\n" + 
11152
		""
11153
	);
11154
	search(
11155
		"foo",
11156
		METHOD,
11157
		DECLARATIONS,
11158
		SearchEngine.createHierarchyScope(null, this.workingCopies[0].findPrimaryType(), false, true, null),
11159
		this.resultCollector);
11160
	// Same results as with the old API
11161
	assertSearchResults(
11162
		"src/Test.java void Test.foo() [foo] EXACT_MATCH\n" + 
11163
		"src/Test.java void Test$Sub.foo() [foo] EXACT_MATCH"
11164
	);
11165
}
11067
}
11166
}
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java (-14 / +52 lines)
Lines 2450-2456 Link Here
2450
    	ICompilationUnit cuB = this. getCompilationUnit("JavaSearch", "src", "a10", "B.java");
2450
    	ICompilationUnit cuB = this. getCompilationUnit("JavaSearch", "src", "a10", "B.java");
2451
        ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2451
        ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2452
        IType type = cuC.getType("C");
2452
        IType type = cuC.getType("C");
2453
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null);
2453
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null);
2454
        
2454
        
2455
        // don't include super-classes:
2455
        // don't include super-classes:
2456
        assertFalse("a10.A should not be included in hierarchy scope", scope.encloses(cuB.getType("A")));
2456
        assertFalse("a10.A should not be included in hierarchy scope", scope.encloses(cuB.getType("A")));
Lines 2464-2474 Link Here
2464
public void testSearchScope07() throws CoreException {
2464
public void testSearchScope07() throws CoreException {
2465
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2465
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2466
        IType type = cuC.getType("C");
2466
        IType type = cuC.getType("C");
2467
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null);
2467
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null);
2468
        
2468
        
2469
        // don't include focus type:
2469
        // don't include focus type:
2470
        assertFalse("a10.C should be not included in hierarchy scope", scope.encloses(type));
2470
        assertFalse("a10.C should not be included in hierarchy scope", scope.encloses(type));
2471
        assertFalse("a10/C.java should be included in hierarchy scope", scope.encloses(cuC.getUnderlyingResource().getFullPath().toString()));       
2471
        assertFalse("a10/C.java should not be included in hierarchy scope", scope.encloses(cuC.getUnderlyingResource().getFullPath().toString()));       
2472
}
2473
/**
2474
 * Hierarchy scope test.
2475
 * test for enhancement bug 215139 encloses(): find only subtypes.
2476
 * also test enhancement bug 295894: include focus type.
2477
 */
2478
public void testSearchScope07a() throws CoreException {
2479
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2480
        IType type = cuC.getType("C");
2481
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null);
2482
        
2483
        // include focus type:
2484
        assertTrue("a10.C should be included in hierarchy scope", scope.encloses(type));
2485
        assertTrue("a10/C.java should be included in hierarchy scope", scope.encloses(cuC.getUnderlyingResource().getFullPath().toString()));       
2472
}
2486
}
2473
/**
2487
/**
2474
 * Hierarchy scope test.
2488
 * Hierarchy scope test.
Lines 2479-2485 Link Here
2479
        ICompilationUnit cuD = this. getCompilationUnit("JavaSearch", "src", "a10", "D.java");
2493
        ICompilationUnit cuD = this. getCompilationUnit("JavaSearch", "src", "a10", "D.java");
2480
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2494
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2481
        IType type = cuC.getType("C");
2495
        IType type = cuC.getType("C");
2482
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null);
2496
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null);
2483
        
2497
        
2484
        // regular sub-types:
2498
        // regular sub-types:
2485
        assertTrue("a10.D should be included in hierarchy scope", scope.encloses(cuD.getType("D")));
2499
        assertTrue("a10.D should be included in hierarchy scope", scope.encloses(cuD.getType("D")));
Lines 2496-2502 Link Here
2496
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2510
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2497
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2511
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2498
        IType type = cuC.getType("C");
2512
        IType type = cuC.getType("C");
2499
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null);
2513
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null);
2500
        
2514
        
2501
        // sub-type is a nested type:
2515
        // sub-type is a nested type:
2502
        assertTrue("a10.H$I should be included in hierarchy scope", scope.encloses(cuE.getType("H").getType("I")));
2516
        assertTrue("a10.H$I should be included in hierarchy scope", scope.encloses(cuE.getType("H").getType("I")));
Lines 2509-2515 Link Here
2509
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2523
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2510
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2524
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2511
        IType type = cuC.getType("C");
2525
        IType type = cuC.getType("C");
2512
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null);
2526
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null);
2513
        
2527
        
2514
        // member of a sub-type:
2528
        // member of a sub-type:
2515
        assertFalse("a10.F$G should not be included in hierarchy scope", scope.encloses(cuE.getType("F").getType("G")));
2529
        assertFalse("a10.F$G should not be included in hierarchy scope", scope.encloses(cuE.getType("F").getType("G")));
Lines 2517-2524 Link Here
2517
/**
2531
/**
2518
 * Hierarchy scope test.
2532
 * Hierarchy scope test.
2519
 * (test for enhancement bug 215139 encloses(): find only subtypes and their member types).
2533
 * (test for enhancement bug 215139 encloses(): find only subtypes and their member types).
2534
 * Note: this combination of arguments is no longer supported after the change from bug 295894
2520
 */
2535
 */
2521
public void testSearchScope11() throws CoreException {
2536
public void _testSearchScope11() throws CoreException {
2522
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2537
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2523
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2538
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2524
        IType type = cuC.getType("C");
2539
        IType type = cuC.getType("C");
Lines 2535-2541 Link Here
2535
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2550
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2536
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2551
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2537
        IType type = cuC.getType("C");
2552
        IType type = cuC.getType("C");
2538
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null);
2553
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null);
2539
        
2554
        
2540
        // enclosing of a sub-type:
2555
        // enclosing of a sub-type:
2541
        assertFalse("a10.H should not be included in hierarchy scope", scope.encloses(cuE.getType("H")));
2556
        assertFalse("a10.H should not be included in hierarchy scope", scope.encloses(cuE.getType("H")));
Lines 2548-2554 Link Here
2548
public void testSearchScope13() throws CoreException {
2563
public void testSearchScope13() throws CoreException {
2549
        ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2564
        ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2550
        IType type = cuC.getType("C");
2565
        IType type = cuC.getType("C");
2551
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null);
2566
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null);
2552
        
2567
        
2553
        search("**", TYPE, DECLARATIONS, scope);
2568
        search("**", TYPE, DECLARATIONS, scope);
2554
        assertSearchResults(
2569
        assertSearchResults(
Lines 2581-2592 Link Here
2581
}
2596
}
2582
/**
2597
/**
2583
 * Hierarchy scope test.
2598
 * Hierarchy scope test.
2599
 * test for enhancement bug 215139 search: find only subtypes - disabled,
2600
 * also test enhancement bug 295894: exclude focus type.
2601
 */
2602
public void testSearchScope14a() throws CoreException {
2603
        ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2604
        IType type = cuC.getType("C");
2605
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, /*onlySubTypes*/false, false, null);
2606
        
2607
        search("**", TYPE, DECLARATIONS, scope);
2608
        assertSearchResults(
2609
        		"src/a10/B.java a10.A [A]\n" + 
2610
        		"src/a10/B.java a10.B [B]\n" + 
2611
        		"src/a10/D.java a10.D [D]\n" + 
2612
        		"src/a10/E.java a10.E [E]\n" + 
2613
        		"src/a10/E.java a10.F [F]\n" + 
2614
        		"src/a10/E.java a10.H$I [I]\n" + 
2615
        		getExternalJCLPathString() + " java.lang.Object"
2616
        		);
2617
}
2618
/**
2619
 * Hierarchy scope test.
2584
 * (test for enhancement bug 215139 search: find only subtypes - different call chain).
2620
 * (test for enhancement bug 215139 search: find only subtypes - different call chain).
2585
 */
2621
 */
2586
public void testSearchScope15() throws CoreException {
2622
public void testSearchScope15() throws CoreException {
2587
        ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2623
        ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2588
        IType type = cuC.getType("C");
2624
        IType type = cuC.getType("C");
2589
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null);
2625
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null);
2590
    	TypeNameMatchCollector collector = new TypeNameMatchCollector() {
2626
    	TypeNameMatchCollector collector = new TypeNameMatchCollector() {
2591
    		public String toString(){
2627
    		public String toString(){
2592
    			return toFullyQualifiedNamesString();
2628
    			return toFullyQualifiedNamesString();
Lines 2610-2617 Link Here
2610
/**
2646
/**
2611
 * Hierarchy scope test.
2647
 * Hierarchy scope test.
2612
 * (test for enhancement bug 215139 search: find only subtypes plus member & enclosing types - different call chain).
2648
 * (test for enhancement bug 215139 search: find only subtypes plus member & enclosing types - different call chain).
2649
 * Note: this combination of arguments is no longer supported after the change from bug 295894
2613
 */
2650
 */
2614
public void testSearchScope16() throws CoreException {
2651
public void _testSearchScope16() throws CoreException {
2615
        ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2652
        ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2616
        IType type = cuC.getType("C");
2653
        IType type = cuC.getType("C");
2617
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null);
2654
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null);
Lines 2645-2651 Link Here
2645
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2682
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2646
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2683
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2647
        IType type = cuC.getType("C");
2684
        IType type = cuC.getType("C");
2648
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null);
2685
        IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null);
2649
        
2686
        
2650
        // method of a member of a sub-type:
2687
        // method of a member of a sub-type:
2651
        assertFalse("a10.F$G.m() should not be included in hierarchy scope", scope.encloses(cuE.getType("F").getType("G").getMethod("m", new String[0])));
2688
        assertFalse("a10.F$G.m() should not be included in hierarchy scope", scope.encloses(cuE.getType("F").getType("G").getMethod("m", new String[0])));
Lines 2653-2660 Link Here
2653
/**
2690
/**
2654
 * Hierarchy scope test.
2691
 * Hierarchy scope test.
2655
 * (test for enhancement bug 215139 encloses(method): find only subtypes but also member types).
2692
 * (test for enhancement bug 215139 encloses(method): find only subtypes but also member types).
2693
 * Note: this combination of arguments is no longer supported after the change from bug 295894
2656
 */
2694
 */
2657
public void testSearchScope18() throws CoreException {
2695
public void _testSearchScope18() throws CoreException {
2658
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2696
    	ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java");
2659
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2697
        ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java");
2660
        IType type = cuC.getType("C");
2698
        IType type = cuC.getType("C");

Return to bug 295894