diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/ExpressionsOfTypeProcessor.kt.172 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/ExpressionsOfTypeProcessor.kt.172 index bc4d7da9f54..9cc0ef13f0d 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/ExpressionsOfTypeProcessor.kt.172 +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/ExpressionsOfTypeProcessor.kt.172 @@ -335,10 +335,11 @@ class ExpressionsOfTypeProcessor( val searchRequestCollector = SearchRequestCollector(SearchSession()) val resultProcessor = StaticMemberRequestResultProcessor(member, classes) + val memberName = runReadAction { member.name } for (klass in classes) { val request = klass.name + "." + declarationName - testLog { "Searched references to static ${member.name} in non-Java files by request $request" } + testLog { "Searched references to static $memberName in non-Java files by request $request" } searchRequestCollector.searchWord( request, classUseScope(klass).intersectWith(memberScope), UsageSearchContext.IN_CODE, true, member, resultProcessor) @@ -347,7 +348,7 @@ class ExpressionsOfTypeProcessor( if (qualifiedName != null) { val importAllUnderRequest = qualifiedName + ".*" - testLog { "Searched references to static ${member.name} in non-Java files by request $importAllUnderRequest" } + testLog { "Searched references to static $memberName in non-Java files by request $importAllUnderRequest" } searchRequestCollector.searchWord( importAllUnderRequest, classUseScope(klass).intersectWith(memberScope), UsageSearchContext.IN_CODE, true, member, resultProcessor) diff --git a/idea/tests/org/jetbrains/kotlin/idea/decompiler/navigation/AbstractNavigateToLibraryTest.kt.172 b/idea/tests/org/jetbrains/kotlin/idea/decompiler/navigation/AbstractNavigateToLibraryTest.kt.172 index a6cbafcb7b6..666043e2623 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/decompiler/navigation/AbstractNavigateToLibraryTest.kt.172 +++ b/idea/tests/org/jetbrains/kotlin/idea/decompiler/navigation/AbstractNavigateToLibraryTest.kt.172 @@ -41,13 +41,13 @@ abstract class AbstractNavigateToLibraryTest : KotlinCodeInsightTestCase() { abstract val expectedFileExt: String protected fun doTestEx(path: String, additionalConfig: (() -> Unit)? = null) { - configureByFile(path) module.configureAs(getProjectDescriptor()) if (additionalConfig != null) { additionalConfig() } + configureByFile(path) NavigationChecker.checkAnnotatedCode(file, File(path.replace(".kt", expectedFileExt))) } diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTest.kt.172 b/idea/tests/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTest.kt.172 index 4de2a776781..a01372f9620 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTest.kt.172 +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTest.kt.172 @@ -19,6 +19,10 @@ package org.jetbrains.kotlin.idea.intentions import com.google.common.collect.Lists import com.intellij.codeInsight.intention.IntentionAction import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.progress.ProgressIndicator +import com.intellij.openapi.progress.ProgressManager +import com.intellij.openapi.progress.Task +import com.intellij.openapi.progress.util.ProgressIndicatorBase import com.intellij.openapi.util.Computable import com.intellij.openapi.util.SystemInfo import com.intellij.openapi.util.io.FileUtil @@ -39,6 +43,8 @@ import org.jetbrains.kotlin.test.KotlinTestUtils import org.junit.Assert import java.io.File import java.util.* +import java.util.concurrent.CompletableFuture +import java.util.concurrent.TimeUnit abstract class AbstractIntentionTest : KotlinLightCodeInsightFixtureTestCase() { protected open fun intentionFileName(): String = ".intention" @@ -124,12 +130,29 @@ abstract class AbstractIntentionTest : KotlinLightCodeInsightFixtureTestCase() { } } + private fun computeUnderProgressIndicatorAndWait(compute: () -> T): T { + val result = CompletableFuture() + val progressIndicator = ProgressIndicatorBase() + try { + val task = object : Task.Backgroundable(project, "isApplicable", false) { + override fun run(indicator: ProgressIndicator) { + result.complete(compute()) + } + } + ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, progressIndicator) + return result.get(10, TimeUnit.SECONDS) + } + finally { + progressIndicator.cancel() + } + } + @Throws(Exception::class) private fun doTestFor(mainFilePath: String, pathToFiles: Map, intentionAction: IntentionAction, fileText: String) { val isApplicableString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// ${isApplicableDirectiveName()}: ") val isApplicableExpected = isApplicableString == null || isApplicableString == "true" - val isApplicableOnPooled = ApplicationManager.getApplication().executeOnPooledThread(java.util.concurrent.Callable { ApplicationManager.getApplication().runReadAction(Computable { intentionAction.isAvailable(project, editor, file) }) }).get() + val isApplicableOnPooled = computeUnderProgressIndicatorAndWait { ApplicationManager.getApplication().runReadAction(Computable { intentionAction.isAvailable(project, editor, file) }) } val isApplicableOnEdt = intentionAction.isAvailable(project, editor, file) diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/AbstractExtractionTest.kt.172 b/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/AbstractExtractionTest.kt.172 index 467ac29ce0c..21ddddc499a 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/AbstractExtractionTest.kt.172 +++ b/idea/tests/org/jetbrains/kotlin/idea/refactoring/introduce/AbstractExtractionTest.kt.172 @@ -341,15 +341,15 @@ abstract class AbstractExtractionTest : KotlinLightCodeInsightFixtureTestCase() name != mainFileName && name.startsWith("$mainFileBaseName.") && (name.endsWith(".kt") || name.endsWith(".java")) } val extraFilesToPsi = extraFiles.associateBy { fixture.configureByFile(it.name) } - val file = fixture.configureByFile(mainFileName) + val fileText = FileUtil.loadFile(File(path), true) - val addKotlinRuntime = InTextDirectivesUtils.findStringWithPrefixes(file.text, "// WITH_RUNTIME") != null + val addKotlinRuntime = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// WITH_RUNTIME") != null if (addKotlinRuntime) { ConfigLibraryUtil.configureKotlinRuntimeAndSdk(myModule, PluginTestCaseBase.mockJdk()) } try { - checkExtract(ExtractTestFiles(path, file, extraFilesToPsi), checkAdditionalAfterdata, action) + checkExtract(ExtractTestFiles(path, fixture.configureByFile(mainFileName), extraFilesToPsi), checkAdditionalAfterdata, action) } finally { if (addKotlinRuntime) {