WaitForFinishedCodeAnalysis: add assert about running on EDT

GitOrigin-RevId: 1945123e84014380c52dde1e59db597b574792f0
This commit is contained in:
Anastasia Katsman
2025-03-24 20:32:48 +00:00
committed by intellij-monorepo-bot
parent a3a39924ca
commit 4150882157
@@ -130,6 +130,9 @@ class CodeAnalysisStateListener(val project: Project, val cs: CoroutineScope) {
* @throws TimeoutException when stopped due to provided [timeout]
*/
suspend fun waitAnalysisToFinish(timeout: Duration? = 5.minutes, throws: Boolean = false, logsError: Boolean = true) {
if (EDT.isCurrentThreadEdt()) {
throw AssertionError("waitAnalysisToFinish should not be called from EDT otherwise there will be freezes")
}
LOG.info("Waiting for code analysis to finish in $timeout")
val future = CompletableFuture<Unit>()
if (timeout != null) {