Scripting: implement correct disposal of REPL state on finalization

#KT-47927 fixed
This commit is contained in:
Ilya Chernikov
2021-08-20 17:29:22 +02:00
committed by TeamCityServer
parent a45e31720c
commit 4243bafd1d
3 changed files with 32 additions and 1 deletions
@@ -37,6 +37,10 @@ class JvmReplCompilerState<CompilationT : JvmReplCompilerState.Compilation>(
}
}
protected fun finalize() {
dispose()
}
fun getCompilationState(scriptCompilationConfiguration: ScriptCompilationConfiguration): CompilationT = lock.write {
if (_compilation == null) {
initializeCompilation(scriptCompilationConfiguration)