Removed factory methods from JetCoreEnvironment since they only invoke constuctor.
This commit is contained in:
@@ -75,7 +75,7 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
|
||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||
configuration.addAll(CommonConfigurationKeys.SOURCE_ROOTS_KEY, Arrays.asList(arguments.sourceFiles));
|
||||
JetCoreEnvironment environmentForJS = JetCoreEnvironment.createCoreEnvironmentForJS(rootDisposable, configuration);
|
||||
JetCoreEnvironment environmentForJS = new JetCoreEnvironment(rootDisposable, configuration);
|
||||
|
||||
Project project = environmentForJS.getProject();
|
||||
|
||||
|
||||
@@ -127,11 +127,11 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
||||
}
|
||||
else if (arguments.script) {
|
||||
List<String> scriptArgs = arguments.freeArgs.subList(1, arguments.freeArgs.size());
|
||||
JetCoreEnvironment environment = JetCoreEnvironment.createCoreEnvironmentForJVM(rootDisposable, configuration);
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(rootDisposable, configuration);
|
||||
noErrors = KotlinToJVMBytecodeCompiler.compileAndExecuteScript(environment, scriptArgs);
|
||||
}
|
||||
else {
|
||||
JetCoreEnvironment environment = JetCoreEnvironment.createCoreEnvironmentForJVM(rootDisposable, configuration);
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(rootDisposable, configuration);
|
||||
noErrors = KotlinToJVMBytecodeCompiler.compileBunchOfSources(environment, jar, outputDir, arguments.includeRuntime);
|
||||
}
|
||||
return noErrors ? OK : COMPILATION_ERROR;
|
||||
|
||||
@@ -101,7 +101,7 @@ public class CompileEnvironmentUtil {
|
||||
configuration.add(CommonConfigurationKeys.SOURCE_ROOTS_KEY, moduleScriptFile);
|
||||
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageCollector);
|
||||
|
||||
JetCoreEnvironment scriptEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(disposable, configuration);
|
||||
JetCoreEnvironment scriptEnvironment = new JetCoreEnvironment(disposable, configuration);
|
||||
|
||||
GenerationState generationState = KotlinToJVMBytecodeCompiler.analyzeAndGenerate(scriptEnvironment, false);
|
||||
if (generationState == null) {
|
||||
|
||||
@@ -55,15 +55,6 @@ import java.util.List;
|
||||
* @author yole
|
||||
*/
|
||||
public class JetCoreEnvironment {
|
||||
@NotNull
|
||||
public static JetCoreEnvironment createCoreEnvironmentForJS(Disposable disposable, @NotNull CompilerConfiguration configuration) {
|
||||
return new JetCoreEnvironment(disposable, configuration);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static JetCoreEnvironment createCoreEnvironmentForJVM(Disposable disposable, @NotNull CompilerConfiguration configuration) {
|
||||
return new JetCoreEnvironment(disposable, configuration);
|
||||
}
|
||||
|
||||
private final JavaCoreApplicationEnvironment applicationEnvironment;
|
||||
private final JavaCoreProjectEnvironment projectEnvironment;
|
||||
|
||||
+2
-3
@@ -103,8 +103,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
Disposable parentDisposable = CompileEnvironmentUtil.createMockDisposable();
|
||||
JetCoreEnvironment moduleEnvironment = null;
|
||||
try {
|
||||
moduleEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(parentDisposable,
|
||||
compilerConfiguration);
|
||||
moduleEnvironment = new JetCoreEnvironment(parentDisposable, compilerConfiguration);
|
||||
|
||||
|
||||
GenerationState generationState = analyzeAndGenerate(moduleEnvironment);
|
||||
@@ -371,7 +370,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
scriptDefinitions != null ? scriptDefinitions : Collections.<JetScriptDefinition>emptyList());
|
||||
compilerConfiguration.put(JVMConfigurationKeys.SCRIPT_PARAMETERS, scriptParameters);
|
||||
|
||||
JetCoreEnvironment environment = JetCoreEnvironment.createCoreEnvironmentForJVM(rootDisposable, compilerConfiguration);
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(rootDisposable, compilerConfiguration);
|
||||
|
||||
try {
|
||||
JetScriptDefinitionProvider.getInstance(environment.getProject()).markFileAsScript(environment.getSourceFiles().get(0));
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ public class ResolveDescriptorsFromExternalLibraries {
|
||||
else {
|
||||
CompilerConfiguration configuration =
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(ConfigurationKind.JDK_AND_ANNOTATIONS, TestJdkKind.FULL_JDK);
|
||||
jetCoreEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(junk, configuration);
|
||||
jetCoreEnvironment = new JetCoreEnvironment(junk, configuration);
|
||||
if (!PathUtil.findRtJar().equals(jar)) {
|
||||
throw new RuntimeException("rt.jar mismatch: " + jar + ", " + PathUtil.findRtJar());
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
|
||||
@Override
|
||||
protected JetCoreEnvironment createEnvironment() {
|
||||
return JetCoreEnvironment.createCoreEnvironmentForJVM(getTestRootDisposable(), new CompilerConfiguration());
|
||||
return new JetCoreEnvironment(getTestRootDisposable(), new CompilerConfiguration());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user