Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs9Tests.java')
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs9Tests.java51
1 files changed, 45 insertions, 6 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs9Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs9Tests.java
index 20381fa9a6..10b1f65708 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs9Tests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs9Tests.java
@@ -4650,10 +4650,50 @@ public void testBug547051_modular() throws Exception {
AtomicBoolean r = new AtomicBoolean(false);
engine.searchAllTypeNames(packageName, SearchPattern.R_PATTERN_MATCH,
typeName, SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CAMELCASE_MATCH,
- TYPE, scope,
- (modifiers, packageName1, simpleTypeName, enclosingTypeNames, path, access) -> r.set(true),
+ TYPE, scope,
+ (modifiers, packageName1, simpleTypeName, enclosingTypeNames, path, access) -> r.set(true),
+ IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, new NullProgressMonitor());
+ assertTrue("Type search has no matches for subtypes of " + type, r.get());
+ }
+ finally {
+ deleteProject("P");
+ }
+}
+
+public void testBug547051_modular2() throws Exception {
+ try {
+ IJavaProject project = createJava9Project("P");
+ IType type = project.findType("java.util.Collection");
+ IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(project, type, Boolean.TRUE, Boolean.TRUE, null);
+ BasicSearchEngine engine = new BasicSearchEngine();
+ char[] packageName = null;
+ char[] typeName = "HashSe".toCharArray();
+ AtomicBoolean r = new AtomicBoolean(false);
+ engine.searchAllTypeNames(packageName, SearchPattern.R_PATTERN_MATCH,
+ typeName, SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CAMELCASE_MATCH,
+ TYPE, scope,
+ (modifiers, packageName1, simpleTypeName, enclosingTypeNames, path, access) -> r.set(true),
+ IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, new NullProgressMonitor());
+ assertTrue("Type search has no matches for subtypes of " + type, r.get());
+ }
+ finally {
+ deleteProject("P");
+ }
+}
+public void testBug547051_modular3() throws Exception {
+ try {
+ IJavaProject project = createJava9Project("P");
+ IType type = project.findType("java.util.Collection");
+ IJavaSearchScope scope = SearchEngine.createStrictHierarchyScope(project, type, Boolean.TRUE, Boolean.TRUE, null);
+ BasicSearchEngine engine = new BasicSearchEngine();
+ char[] packageName = "java.util".toCharArray();
+ char[] typeName = "HashSet".toCharArray();
+ AtomicBoolean r = new AtomicBoolean(false);
+ engine.searchAllTypeNames(packageName, SearchPattern.R_PATTERN_MATCH,
+ typeName, SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CAMELCASE_MATCH,
+ TYPE, scope,
+ (modifiers, packageName1, simpleTypeName, enclosingTypeNames, path, access) -> r.set(true),
IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, new NullProgressMonitor());
-
assertTrue("Type search has no matches for subtypes of " + type, r.get());
}
finally {
@@ -4665,9 +4705,8 @@ public void testBug547095_local_variables_search_modular() throws Exception {
try {
IJavaProject project = createJava9Project("P");
IType type = project.findType("java.util.Collection");
-
IMethod method = type.getMethod("equals", new String[] {"Ljava.lang.Object;" });
- LocalVariable lv = new LocalVariable(((JavaElement)method), "o", 0, 0, 0, 0, "QObject;", null, 0, true);
+ LocalVariable lv = new LocalVariable(((JavaElement)method), "o", 0, 0, 0, 0, "QObject;", null, 0, true);
SearchPattern pattern = SearchPattern.createPattern(lv, REFERENCES, SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE | SearchPattern.R_ERASURE_MATCH);
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { project }, SYSTEM_LIBRARIES | APPLICATION_LIBRARIES | REFERENCED_PROJECTS | SOURCES);
search(pattern, scope, this.resultCollector);
@@ -4682,7 +4721,7 @@ public void testBug547095_type_patter_search_modular() throws Exception {
try {
IJavaProject project = createJava9Project("P");
IType type = project.findType("java.util.Collection");
- TypeParameter tp = new TypeParameter(((JavaElement)type), "E");
+ TypeParameter tp = new TypeParameter(((JavaElement)type), "E");
SearchPattern pattern = SearchPattern.createPattern(tp, REFERENCES, SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE | SearchPattern.R_ERASURE_MATCH);
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { project }, SYSTEM_LIBRARIES | APPLICATION_LIBRARIES | REFERENCED_PROJECTS | SOURCES);
search(pattern, scope, this.resultCollector);

Back to the top