Disposal on error when processing module script.
This commit is contained in:
@@ -99,17 +99,20 @@ public class CompileEnvironmentUtil {
|
|||||||
configuration.add(CommonConfigurationKeys.SOURCE_ROOTS_KEY, moduleScriptFile);
|
configuration.add(CommonConfigurationKeys.SOURCE_ROOTS_KEY, moduleScriptFile);
|
||||||
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageCollector);
|
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageCollector);
|
||||||
|
|
||||||
JetCoreEnvironment scriptEnvironment = new JetCoreEnvironment(disposable, configuration);
|
List<Module> modules;
|
||||||
|
try {
|
||||||
|
JetCoreEnvironment scriptEnvironment = new JetCoreEnvironment(disposable, configuration);
|
||||||
|
GenerationState generationState = KotlinToJVMBytecodeCompiler.analyzeAndGenerate(scriptEnvironment, false);
|
||||||
|
if (generationState == null) {
|
||||||
|
throw new CompileEnvironmentException("Module script " + moduleScriptFile + " analyze failed:\n" +
|
||||||
|
loadModuleScriptText(moduleScriptFile));
|
||||||
|
}
|
||||||
|
|
||||||
GenerationState generationState = KotlinToJVMBytecodeCompiler.analyzeAndGenerate(scriptEnvironment, false);
|
modules = runDefineModules(paths, moduleScriptFile, generationState.getFactory());
|
||||||
if (generationState == null) {
|
}
|
||||||
throw new CompileEnvironmentException("Module script " + moduleScriptFile + " analyze failed:\n" +
|
finally {
|
||||||
loadModuleScriptText(moduleScriptFile));
|
Disposer.dispose(disposable);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Module> modules = runDefineModules(paths, moduleScriptFile, generationState.getFactory());
|
|
||||||
|
|
||||||
Disposer.dispose(disposable);
|
|
||||||
|
|
||||||
if (modules == null) {
|
if (modules == null) {
|
||||||
throw new CompileEnvironmentException("Module script " + moduleScriptFile + " compilation failed");
|
throw new CompileEnvironmentException("Module script " + moduleScriptFile + " compilation failed");
|
||||||
|
|||||||
Reference in New Issue
Block a user