[Test] Add debug names to unnamed test disposables

- This helps to track down disposables which are never disposed, and
  reduces confusion when printing disposables in general (the names will
  now be meaningful, instead of endless lists of "newDisposable" and
  "TestDisposable").

^KT-64099
This commit is contained in:
Marco Pennekamp
2023-12-05 20:40:50 +01:00
committed by Space Team
parent bba5447b12
commit 32fe29b8cc
33 changed files with 57 additions and 34 deletions
@@ -100,7 +100,7 @@ open class IncrementalFirJvmCompilerRunner(
val exitCode = ExitCode.OK
val allCompiledSources = LinkedHashSet<File>()
val rootDisposable = Disposer.newDisposable()
val rootDisposable = Disposer.newDisposable("Disposable for ${IncrementalFirJvmCompilerRunner::class.simpleName}.runCompiler")
try {
// - configuration
@@ -107,7 +107,8 @@ open class IncrementalJvmCompilerRunner(
psiFileFactory.createFileFromText(file.nameWithoutExtension, JavaLanguage.INSTANCE, file.readText())
private val psiFileFactory: PsiFileFactory by lazy {
val rootDisposable = Disposer.newDisposable()
val rootDisposable =
Disposer.newDisposable("Disposable for PSI file factory of ${IncrementalJvmCompilerRunner::class.simpleName}")
val configuration = compilerConfiguration
val environment =
KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
@@ -30,7 +30,7 @@ fun classesFqNames(files: Set<File>): Set<String> {
val existingKotlinFiles = files.filter { it.name.endsWith(".kt", ignoreCase = true) && it.isFile }
if (existingKotlinFiles.isEmpty()) return emptySet()
val disposable = Disposer.newDisposable()
val disposable = Disposer.newDisposable("Disposable for org.jetbrains.kotlin.incremental.parsing.classesFqNames")
return try {
classesFqNames(existingKotlinFiles, disposable)