Lines 1357-1362
Link Here
|
1357 |
/** |
1357 |
/** |
1358 |
* Method declaration in hierarchy test. |
1358 |
* Method declaration in hierarchy test. |
1359 |
* Explicitly request behavior pre https://bugs.eclipse.org/bugs/show_bug.cgi?id=215139 |
1359 |
* Explicitly request behavior pre https://bugs.eclipse.org/bugs/show_bug.cgi?id=215139 |
|
|
1360 |
* @deprecated tests a deprecated API |
1360 |
*/ |
1361 |
*/ |
1361 |
public void testMethodDeclaration04() throws CoreException { // was testMethodDeclarationInHierarchyScope1 |
1362 |
public void testMethodDeclaration04() throws CoreException { // was testMethodDeclarationInHierarchyScope1 |
1362 |
IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X"); |
1363 |
IType type = getCompilationUnit("JavaSearch", "src", "p", "X.java").getType("X"); |
Lines 2450-2456
Link Here
|
2450 |
ICompilationUnit cuB = this. getCompilationUnit("JavaSearch", "src", "a10", "B.java"); |
2451 |
ICompilationUnit cuB = this. getCompilationUnit("JavaSearch", "src", "a10", "B.java"); |
2451 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2452 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2452 |
IType type = cuC.getType("C"); |
2453 |
IType type = cuC.getType("C"); |
2453 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2454 |
IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(null, type, true, false, null); |
2454 |
|
2455 |
|
2455 |
// don't include super-classes: |
2456 |
// don't include super-classes: |
2456 |
assertFalse("a10.A should not be included in hierarchy scope", scope.encloses(cuB.getType("A"))); |
2457 |
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 { |
2465 |
public void testSearchScope07() throws CoreException { |
2465 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2466 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2466 |
IType type = cuC.getType("C"); |
2467 |
IType type = cuC.getType("C"); |
2467 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2468 |
IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(null, type, true, false, null); |
2468 |
|
2469 |
|
2469 |
// don't include focus type: |
2470 |
// don't include focus type: |
2470 |
assertFalse("a10.C should be not included in hierarchy scope", scope.encloses(type)); |
2471 |
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())); |
2472 |
assertFalse("a10/C.java should not be included in hierarchy scope", scope.encloses(cuC.getUnderlyingResource().getFullPath().toString())); |
|
|
2473 |
} |
2474 |
/** |
2475 |
* Hierarchy scope test. |
2476 |
* test for enhancement bug 215139 encloses(): find only subtypes. |
2477 |
* also test enhancement bug 295894: include focus type. |
2478 |
*/ |
2479 |
public void testSearchScope07a() throws CoreException { |
2480 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2481 |
IType type = cuC.getType("C"); |
2482 |
IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(null, type, true, true, null); |
2483 |
|
2484 |
// include focus type: |
2485 |
assertTrue("a10.C should be included in hierarchy scope", scope.encloses(type)); |
2486 |
assertTrue("a10/C.java should be included in hierarchy scope", scope.encloses(cuC.getUnderlyingResource().getFullPath().toString())); |
2472 |
} |
2487 |
} |
2473 |
/** |
2488 |
/** |
2474 |
* Hierarchy scope test. |
2489 |
* Hierarchy scope test. |
Lines 2479-2485
Link Here
|
2479 |
ICompilationUnit cuD = this. getCompilationUnit("JavaSearch", "src", "a10", "D.java"); |
2494 |
ICompilationUnit cuD = this. getCompilationUnit("JavaSearch", "src", "a10", "D.java"); |
2480 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2495 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2481 |
IType type = cuC.getType("C"); |
2496 |
IType type = cuC.getType("C"); |
2482 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2497 |
IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(null, type, true, false, null); |
2483 |
|
2498 |
|
2484 |
// regular sub-types: |
2499 |
// regular sub-types: |
2485 |
assertTrue("a10.D should be included in hierarchy scope", scope.encloses(cuD.getType("D"))); |
2500 |
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"); |
2511 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2497 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2512 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2498 |
IType type = cuC.getType("C"); |
2513 |
IType type = cuC.getType("C"); |
2499 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2514 |
IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(null, type, true, false, null); |
2500 |
|
2515 |
|
2501 |
// sub-type is a nested type: |
2516 |
// sub-type is a nested type: |
2502 |
assertTrue("a10.H$I should be included in hierarchy scope", scope.encloses(cuE.getType("H").getType("I"))); |
2517 |
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"); |
2524 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2510 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2525 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2511 |
IType type = cuC.getType("C"); |
2526 |
IType type = cuC.getType("C"); |
2512 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2527 |
IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(null, type, true, false, null); |
2513 |
|
2528 |
|
2514 |
// member of a sub-type: |
2529 |
// member of a sub-type: |
2515 |
assertFalse("a10.F$G should not be included in hierarchy scope", scope.encloses(cuE.getType("F").getType("G"))); |
2530 |
assertFalse("a10.F$G should not be included in hierarchy scope", scope.encloses(cuE.getType("F").getType("G"))); |
Lines 2517-2522
Link Here
|
2517 |
/** |
2532 |
/** |
2518 |
* Hierarchy scope test. |
2533 |
* Hierarchy scope test. |
2519 |
* (test for enhancement bug 215139 encloses(): find only subtypes and their member types). |
2534 |
* (test for enhancement bug 215139 encloses(): find only subtypes and their member types). |
|
|
2535 |
* @deprecated tests a deprecated API |
2520 |
*/ |
2536 |
*/ |
2521 |
public void testSearchScope11() throws CoreException { |
2537 |
public void testSearchScope11() throws CoreException { |
2522 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2538 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
Lines 2535-2541
Link Here
|
2535 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2551 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2536 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2552 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2537 |
IType type = cuC.getType("C"); |
2553 |
IType type = cuC.getType("C"); |
2538 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2554 |
IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(null, type, true, false, null); |
2539 |
|
2555 |
|
2540 |
// enclosing of a sub-type: |
2556 |
// enclosing of a sub-type: |
2541 |
assertFalse("a10.H should not be included in hierarchy scope", scope.encloses(cuE.getType("H"))); |
2557 |
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 { |
2564 |
public void testSearchScope13() throws CoreException { |
2549 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2565 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2550 |
IType type = cuC.getType("C"); |
2566 |
IType type = cuC.getType("C"); |
2551 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2567 |
IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(null, type, true, false, null); |
2552 |
|
2568 |
|
2553 |
search("**", TYPE, DECLARATIONS, scope); |
2569 |
search("**", TYPE, DECLARATIONS, scope); |
2554 |
assertSearchResults( |
2570 |
assertSearchResults( |
Lines 2565-2571
Link Here
|
2565 |
public void testSearchScope14() throws CoreException { |
2581 |
public void testSearchScope14() throws CoreException { |
2566 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2582 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2567 |
IType type = cuC.getType("C"); |
2583 |
IType type = cuC.getType("C"); |
2568 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, /*onlySubTypes*/false, true, null); |
2584 |
IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(null, type, /*onlySubTypes*/false, true, null); |
2569 |
|
2585 |
|
2570 |
search("**", TYPE, DECLARATIONS, scope); |
2586 |
search("**", TYPE, DECLARATIONS, scope); |
2571 |
assertSearchResults( |
2587 |
assertSearchResults( |
Lines 2581-2592
Link Here
|
2581 |
} |
2597 |
} |
2582 |
/** |
2598 |
/** |
2583 |
* Hierarchy scope test. |
2599 |
* Hierarchy scope test. |
|
|
2600 |
* test for enhancement bug 215139 search: find only subtypes - disabled, |
2601 |
* also test enhancement bug 295894: exclude focus type. |
2602 |
*/ |
2603 |
public void testSearchScope14a() throws CoreException { |
2604 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2605 |
IType type = cuC.getType("C"); |
2606 |
IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(null, type, /*onlySubTypes*/false, false, null); |
2607 |
|
2608 |
search("**", TYPE, DECLARATIONS, scope); |
2609 |
assertSearchResults( |
2610 |
"src/a10/B.java a10.A [A]\n" + |
2611 |
"src/a10/B.java a10.B [B]\n" + |
2612 |
"src/a10/D.java a10.D [D]\n" + |
2613 |
"src/a10/E.java a10.E [E]\n" + |
2614 |
"src/a10/E.java a10.F [F]\n" + |
2615 |
"src/a10/E.java a10.H$I [I]\n" + |
2616 |
getExternalJCLPathString() + " java.lang.Object" |
2617 |
); |
2618 |
} |
2619 |
/** |
2620 |
* Hierarchy scope test. |
2584 |
* (test for enhancement bug 215139 search: find only subtypes - different call chain). |
2621 |
* (test for enhancement bug 215139 search: find only subtypes - different call chain). |
2585 |
*/ |
2622 |
*/ |
2586 |
public void testSearchScope15() throws CoreException { |
2623 |
public void testSearchScope15() throws CoreException { |
2587 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2624 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2588 |
IType type = cuC.getType("C"); |
2625 |
IType type = cuC.getType("C"); |
2589 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2626 |
IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(null, type, true, false, null); |
2590 |
TypeNameMatchCollector collector = new TypeNameMatchCollector() { |
2627 |
TypeNameMatchCollector collector = new TypeNameMatchCollector() { |
2591 |
public String toString(){ |
2628 |
public String toString(){ |
2592 |
return toFullyQualifiedNamesString(); |
2629 |
return toFullyQualifiedNamesString(); |
Lines 2610-2615
Link Here
|
2610 |
/** |
2647 |
/** |
2611 |
* Hierarchy scope test. |
2648 |
* Hierarchy scope test. |
2612 |
* (test for enhancement bug 215139 search: find only subtypes plus member & enclosing types - different call chain). |
2649 |
* (test for enhancement bug 215139 search: find only subtypes plus member & enclosing types - different call chain). |
|
|
2650 |
* @deprecated tests a deprecated API |
2613 |
*/ |
2651 |
*/ |
2614 |
public void testSearchScope16() throws CoreException { |
2652 |
public void testSearchScope16() throws CoreException { |
2615 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2653 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
Lines 2645-2651
Link Here
|
2645 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2683 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2646 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2684 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2647 |
IType type = cuC.getType("C"); |
2685 |
IType type = cuC.getType("C"); |
2648 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2686 |
IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(null, type, true, false, null); |
2649 |
|
2687 |
|
2650 |
// method of a member of a sub-type: |
2688 |
// 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]))); |
2689 |
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-2658
Link Here
|
2653 |
/** |
2691 |
/** |
2654 |
* Hierarchy scope test. |
2692 |
* Hierarchy scope test. |
2655 |
* (test for enhancement bug 215139 encloses(method): find only subtypes but also member types). |
2693 |
* (test for enhancement bug 215139 encloses(method): find only subtypes but also member types). |
|
|
2694 |
* @deprecated tests a deprecated API |
2656 |
*/ |
2695 |
*/ |
2657 |
public void testSearchScope18() throws CoreException { |
2696 |
public void testSearchScope18() throws CoreException { |
2658 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2697 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |