diff --git a/scip-java/src/main/kotlin/org/scip_code/scip_java/ScipJava.kt b/scip-java/src/main/kotlin/org/scip_code/scip_java/ScipJava.kt index 2e6ddbde6..a970e5056 100644 --- a/scip-java/src/main/kotlin/org/scip_code/scip_java/ScipJava.kt +++ b/scip-java/src/main/kotlin/org/scip_code/scip_java/ScipJava.kt @@ -18,7 +18,7 @@ object ScipJava { @JvmStatic fun main(args: Array) { app.runAndExitIfNonZero(args.toList()) - // The Analysis API indexer leaves non-daemon threads behind; exit explicitly. + // IntelliJ's application thread pool keeps the JVM alive (see KotlinAnalysisIndexer). exitProcess(0) } diff --git a/scip-kotlin-analysis/src/main/kotlin/org/scip_code/scip_java/kotlin_analysis/KotlinAnalysisIndexer.kt b/scip-kotlin-analysis/src/main/kotlin/org/scip_code/scip_java/kotlin_analysis/KotlinAnalysisIndexer.kt index 1c1dd00e4..8f1aadee4 100644 --- a/scip-kotlin-analysis/src/main/kotlin/org/scip_code/scip_java/kotlin_analysis/KotlinAnalysisIndexer.kt +++ b/scip-kotlin-analysis/src/main/kotlin/org/scip_code/scip_java/kotlin_analysis/KotlinAnalysisIndexer.kt @@ -81,6 +81,10 @@ import org.scip_code.scip_java.shared.ScipShardWriter * One SCIP shard is written per source file under * `/META-INF/scip/.scip`, the layout produced by the scip-javac * compiler plugin. + * + * The JVM does not exit on its own after [run]. The Analysis API starts IntelliJ's process-wide + * application thread pool, which keeps a non-daemon thread alive and cannot be shut down without + * breaking later runs in the same process. Command-line callers must call `exitProcess` when done. */ class KotlinAnalysisIndexer( private val sourceroot: Path, diff --git a/scip-kotlin-analysis/src/main/kotlin/org/scip_code/scip_java/kotlin_analysis/Main.kt b/scip-kotlin-analysis/src/main/kotlin/org/scip_code/scip_java/kotlin_analysis/Main.kt index ee447f4fc..99d1e6502 100644 --- a/scip-kotlin-analysis/src/main/kotlin/org/scip_code/scip_java/kotlin_analysis/Main.kt +++ b/scip-kotlin-analysis/src/main/kotlin/org/scip_code/scip_java/kotlin_analysis/Main.kt @@ -37,8 +37,8 @@ fun main(args: Array) { require(sourceroot != null) { "missing required flag: --sourceroot" } require(targetroot != null) { "missing required flag: --targetroot" } require(sourceRoots.isNotEmpty()) { "missing source files or directories" } - // The Analysis API environment leaves non-daemon threads behind; exit - // explicitly, also on failure, so callers are not left waiting on them. + // IntelliJ's application thread pool keeps the JVM alive (see KotlinAnalysisIndexer); + // exit explicitly, also on failure, so callers are not left waiting on it. try { KotlinAnalysisIndexer( sourceroot = sourceroot,