diff --git a/java/java-tests/testSrc/com/intellij/java/index/ConcurrentIndexTest.groovy b/java/java-tests/testSrc/com/intellij/java/index/ConcurrentIndexTest.groovy index 3e9f100d8b0d..5a4c6f46b122 100644 --- a/java/java-tests/testSrc/com/intellij/java/index/ConcurrentIndexTest.groovy +++ b/java/java-tests/testSrc/com/intellij/java/index/ConcurrentIndexTest.groovy @@ -19,10 +19,7 @@ import com.intellij.lang.FCTSBackedLighterAST import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.ReadAction import com.intellij.openapi.command.WriteCommandAction -import com.intellij.psi.JavaPsiFacade -import com.intellij.psi.PsiDocumentManager -import com.intellij.psi.PsiFile -import com.intellij.psi.PsiJavaFile +import com.intellij.psi.* import com.intellij.psi.impl.PsiDocumentManagerBase import com.intellij.psi.impl.search.JavaNullMethodArgumentUtil import com.intellij.psi.impl.source.PsiFileImpl @@ -32,6 +29,7 @@ import com.intellij.testFramework.PlatformTestUtil import com.intellij.testFramework.SkipSlowTestLocally import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase import com.intellij.util.ref.GCUtil +import groovy.transform.CompileStatic import java.util.concurrent.CountDownLatch import java.util.concurrent.Future @@ -39,6 +37,7 @@ import java.util.concurrent.Future * @author peter */ @SkipSlowTestLocally +@CompileStatic class ConcurrentIndexTest extends JavaCodeInsightFixtureTestCase { @Override protected void setUp() throws Exception { @@ -48,14 +47,14 @@ class ConcurrentIndexTest extends JavaCodeInsightFixtureTestCase { void "test concurrent switching with checkCanceled"() { def N = Math.max(2, (int)(Runtime.runtime.availableProcessors())) - int halfN = N / 2 + def halfN = N / 2 for (iteration in 1..200) { def name = "Foo" + iteration // if (iteration % 10 == 0) println "Finding $name" //noinspection GroovyUnusedAssignment PsiFile file = myFixture.addFileToProject("${name}.java", "class $name {}") - def futuresToWait = [] + List futuresToWait = [] def sameStartCondition = new CountDownLatch(N) for(i in 1.. halfN) { @@ -86,8 +85,8 @@ class ConcurrentIndexTest extends JavaCodeInsightFixtureTestCase { } } - private void checkFindClass(name) { - def clazz = myFixture.findClass(name) + private void checkFindClass(String name) { + PsiClass clazz = myFixture.findClass(name) def node = clazz.node if (node == null) { assert false @@ -96,7 +95,7 @@ class ConcurrentIndexTest extends JavaCodeInsightFixtureTestCase { void "test cancellable and non-cancellable progress"() { def N = Math.max(2, (int)(Runtime.runtime.availableProcessors())) - int halfN = N / 2 + def halfN = N / 2 PsiFileImpl file = (PsiFileImpl) myFixture.addFileToProject("Foo.java", "class Foo {" + ("public void foo() {}\n") * 1000 + "}") assert myFixture.findClass("Foo").node @@ -108,7 +107,7 @@ class ConcurrentIndexTest extends JavaCodeInsightFixtureTestCase { PlatformTestUtil.tryGcSoftlyReachableObjects() assert !file.contentsLoaded - def futuresToWait = [] + List futuresToWait = [] def sameStartCondition = new CountDownLatch(N) for(j in 1..halfN) { @@ -139,7 +138,7 @@ class ConcurrentIndexTest extends JavaCodeInsightFixtureTestCase { void "test forceUpdateAffectsReadOfDataForUnsavedDocuments"() { def N = Math.max(2, (int)(Runtime.runtime.availableProcessors())) - int halfN = N / 2 + def halfN = N / 2 PsiFileImpl file = (PsiFileImpl) myFixture.addFileToProject("Foo.java", "class Foo {" + ("public void foo() {}\n") * 1000 + "}") assert myFixture.findClass("Foo").node @@ -153,7 +152,7 @@ class ConcurrentIndexTest extends JavaCodeInsightFixtureTestCase { myFixture.addFileToProject("Foo" + i + ".java", "class Foo" + i + " {" + ("public void foo() {}\n") * 1000 + "}") - def futuresToWait = [] + List futuresToWait = [] def sameStartCondition = new CountDownLatch(N) for(j in 1..halfN) { @@ -210,5 +209,4 @@ class ConcurrentIndexTest extends JavaCodeInsightFixtureTestCase { futures.each { it.get() } } } - }