From e7e17cdaa9a63684db38d1e6804864fdf1956d84 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 3 Mar 2021 19:55:23 +0100 Subject: [PATCH] Revert "Fix KotlinCoreEnvironment projectCount disposable" This reverts commit 99a6bdeec7f052b180d859f59cbc5829ab6e9034. #KT-45007 Fixed --- .../kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt index 5caa291fbc6..37a70e03dc9 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt @@ -501,13 +501,10 @@ class KotlinCoreEnvironment private constructor( if (CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.value.toBooleanLenient() != true) { // JPS may run many instances of the compiler in parallel (there's an option for compiling independent modules in parallel in IntelliJ) // All projects share the same ApplicationEnvironment, and when the last project is disposed, the ApplicationEnvironment is disposed as well - @Suppress("ObjectLiteralToLambda") // Disposer tree depends on identity of disposables. - Disposer.register(parentDisposable, object : Disposable { - override fun dispose() { - synchronized(APPLICATION_LOCK) { - if (--ourProjectCount <= 0) { - disposeApplicationEnvironment() - } + Disposer.register(parentDisposable, Disposable { + synchronized(APPLICATION_LOCK) { + if (--ourProjectCount <= 0) { + disposeApplicationEnvironment() } } })