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 e7325534bea..fb78c4057b3 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 @@ -323,7 +323,6 @@ class KotlinCoreEnvironment private constructor( } private fun createApplicationEnvironment(parentDisposable: Disposable, configuration: CompilerConfiguration, configFilePaths: List): JavaCoreApplicationEnvironment { - Extensions.cleanRootArea(parentDisposable) registerAppExtensionPoints() val applicationEnvironment = JavaCoreApplicationEnvironment(parentDisposable) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java index 29332f05df1..d40ecd2335d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.codegen; import com.intellij.openapi.Disposable; import com.intellij.openapi.util.Disposer; +import com.intellij.openapi.util.text.StringUtil; import kotlin.Pair; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -102,9 +103,10 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest @NotNull protected ClassFileFactory compileA(@NotNull String fileName, @NotNull String content, List files) throws IOException { + Disposable compileDisposable = createDisposable("compileA"); KotlinCoreEnvironment environment = - KotlinTestUtils.createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(getTestRootDisposable(), ConfigurationKind.ALL, getJdkKind(files)); - return compileKotlin(fileName, content, aDir, environment, getTestRootDisposable()); + KotlinTestUtils.createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(compileDisposable, ConfigurationKind.ALL, getJdkKind(files)); + return compileKotlin(fileName, content, aDir, environment, compileDisposable); } @NotNull @@ -112,10 +114,17 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest CompilerConfiguration configurationWithADirInClasspath = KotlinTestUtils .compilerConfigurationForTests(ConfigurationKind.ALL, getJdkKind(files), KotlinTestUtils.getAnnotationsJar(), aDir); - KotlinCoreEnvironment environment = - KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configurationWithADirInClasspath, EnvironmentConfigFiles.JVM_CONFIG_FILES); + Disposable compileDisposable = createDisposable("compileB"); + KotlinCoreEnvironment environment = KotlinCoreEnvironment.createForTests( + compileDisposable, configurationWithADirInClasspath, EnvironmentConfigFiles.JVM_CONFIG_FILES); - return compileKotlin(fileName, content, bDir, environment, getTestRootDisposable()); + return compileKotlin(fileName, content, bDir, environment, compileDisposable); + } + + private Disposable createDisposable(String debugName) { + Disposable disposable = Disposer.newDisposable("CompileDisposable" + debugName); + Disposer.register(getTestRootDisposable(), disposable); + return disposable; } @NotNull