Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGayan Perera2020-12-07 21:13:13 +0000
committerAndrey Loskutov2020-12-31 19:06:20 +0000
commite019ff17ddcb3382630909c4aed6979e841229b4 (patch)
tree5a7627e5dc679efad3ac382819b75a5399fd2fe9 /org.eclipse.jdt.core.tests.model
parentca5f41b9281c66c20874cdd0c498256a910212b7 (diff)
downloadeclipse.jdt.core-e019ff17ddcb3382630909c4aed6979e841229b4.tar.gz
eclipse.jdt.core-e019ff17ddcb3382630909c4aed6979e841229b4.tar.xz
eclipse.jdt.core-e019ff17ddcb3382630909c4aed6979e841229b4.zip
Bug 567521 - Improve type hierarchy build time.I20210101-0720I20201231-1800
Introduced IParallelizable interface to mark search participants, patterns and scopes eligible for parallel search. If search scope, participant and pattern given to PatternSearchJob all support parallel search, parallelize index search by using ForkJoinPool.commonPool() to schedule search tasks. If this behavior is not desired, org.eclipse.jdt.core/enableParallelJavaIndexSearch=false preference can be set. Change-Id: Iad18e2d14a9ce2603e5704197706c97bbfb8eea9 Signed-off-by: Gayan Perera <gayanper@gmail.com>
Diffstat (limited to 'org.eclipse.jdt.core.tests.model')
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java
index 53740a9e94..705a5ea3b3 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java
@@ -8618,7 +8618,16 @@ public void testBug166348_Qualified() throws CoreException {
* @test Ensure that types are found even when scope is not a {@link org.eclipse.jdt.internal.core.search.JavaSearchScope}
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=167190"
*/
+public void testBug167190_Parallel() throws CoreException, JavaModelException {
+ bug167190(true);
+}
+
public void testBug167190() throws CoreException, JavaModelException {
+ bug167190(false);
+}
+
+private void bug167190(boolean parallel) throws JavaModelException {
+
IJavaSearchScope scope = new AbstractSearchScope() {
IJavaSearchScope jsScope = getJavaSearchScope();
public void processDelta(IJavaElementDelta delta, int eventType) {
@@ -8633,6 +8642,10 @@ public void testBug167190() throws CoreException, JavaModelException {
public IPath[] enclosingProjectsAndJars() {
return this.jsScope.enclosingProjectsAndJars();
}
+ @Override
+ public boolean isParallelSearchSupported() {
+ return parallel;
+ }
};
// Search all type names with TypeNameMatchRequestor
TypeNameMatchCollector collector = new TypeNameMatchCollector() {
@@ -8664,7 +8677,7 @@ public void testBug167190() throws CoreException, JavaModelException {
IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
null);
// Should have same types with these 2 searches
- assertEquals("Found types sounds not to be correct", requestor.toString(), collector.toString());
+ assertEquals(String.format("Found types sounds not to be correct [Parallel=%s]", parallel), requestor.toString(), collector.toString());
}
/**

Back to the top