From b1db3aa8a5f5bf17c81f307149a3ae6944e82018 Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Mon, 13 Feb 2012 20:27:42 +0400 Subject: [PATCH] Added CompileEnvironment.dispose() in KotlinCompiler to restore original Application after compilation. --- .../org/jetbrains/jet/cli/KotlinCompiler.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java b/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java index 8f2de696738..7a6b80c887b 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java +++ b/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java @@ -97,23 +97,27 @@ public class KotlinCompiler { } CompileEnvironment environment = new CompileEnvironment(arguments.transformNamesToJava ? ANY_EXTENSION_TO_JAVA : FileNameTransformer.IDENTITY); - environment.setIgnoreErrors(arguments.ignoreErrors); - environment.setErrorStream(errStream); + try { + environment.setIgnoreErrors(arguments.ignoreErrors); + environment.setErrorStream(errStream); - if (arguments.stdlib != null) { - environment.setStdlib(arguments.stdlib); - } - - if (arguments.module != null) { - environment.compileModuleScript(arguments.module, arguments.jar, arguments.outputDir, arguments.includeRuntime); - return 0; - } - else { - if (!environment.compileBunchOfSources(arguments.src, arguments.jar, arguments.outputDir, arguments.includeRuntime)) { - return 1; + if (arguments.stdlib != null) { + environment.setStdlib(arguments.stdlib); } - } - return 0; + if (arguments.module != null) { + environment.compileModuleScript(arguments.module, arguments.jar, arguments.outputDir, arguments.includeRuntime); + return 0; + } + else { + if (!environment.compileBunchOfSources(arguments.src, arguments.jar, arguments.outputDir, arguments.includeRuntime)) { + return 1; + } + } + + return 0; + } finally { + environment.dispose(); + } } }