Changed types of JVM configuration keys from arrays to lists.
This commit is contained in:
@@ -19,6 +19,7 @@ package org.jetbrains.jet.cli.jvm;
|
||||
import com.intellij.openapi.util.Key;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Evgeny Gerashchenko
|
||||
@@ -28,6 +29,6 @@ public class JVMConfigurationKeys {
|
||||
private JVMConfigurationKeys() {
|
||||
}
|
||||
|
||||
public static final Key<File[]> CLASSPATH_KEY = Key.create("classpath");
|
||||
public static final Key<File[]> ANNOTATIONS_PATH_KEY = Key.create("annotations path");
|
||||
public static final Key<List<File>> CLASSPATH_KEY = Key.create("classpath");
|
||||
public static final Key<List<File>> ANNOTATIONS_PATH_KEY = Key.create("annotations path");
|
||||
}
|
||||
|
||||
@@ -163,8 +163,8 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments, K2JVMComp
|
||||
@NotNull
|
||||
private static CompilerConfiguration createCompilerConfiguration(@NotNull K2JVMCompilerArguments arguments) {
|
||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||
configuration.put(JVMConfigurationKeys.CLASSPATH_KEY, getClasspath(arguments).toArray(new File[0]));
|
||||
configuration.put(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, getAnnotationsPath(arguments).toArray(new File[0]));
|
||||
configuration.addAll(JVMConfigurationKeys.CLASSPATH_KEY, getClasspath(arguments));
|
||||
configuration.addAll(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, getAnnotationsPath(arguments));
|
||||
return configuration;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.jar.*;
|
||||
|
||||
@@ -142,13 +143,13 @@ public class CompileEnvironmentUtil {
|
||||
}
|
||||
};
|
||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||
configuration.put(JVMConfigurationKeys.CLASSPATH_KEY, new File[]{
|
||||
configuration.put(JVMConfigurationKeys.CLASSPATH_KEY, Arrays.asList(
|
||||
PathUtil.findRtJar(),
|
||||
PathUtil.getDefaultRuntimePath()
|
||||
});
|
||||
configuration.put(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, new File[]{
|
||||
));
|
||||
configuration.put(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, Arrays.asList(
|
||||
PathUtil.getJdkAnnotationsPath()
|
||||
});
|
||||
));
|
||||
JetCoreEnvironment scriptEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(disposable, configuration);
|
||||
scriptEnvironment.addSources(moduleScriptFile);
|
||||
|
||||
|
||||
@@ -168,8 +168,8 @@ public class JetCoreEnvironment extends JavaCoreEnvironment {
|
||||
}
|
||||
|
||||
public void configure(@NotNull CompilerConfiguration compilerConfiguration) {
|
||||
File[] classpath = compilerConfiguration.get(JVMConfigurationKeys.CLASSPATH_KEY);
|
||||
File[] annotationsPath = compilerConfiguration.get(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY);
|
||||
List<File> classpath = compilerConfiguration.get(JVMConfigurationKeys.CLASSPATH_KEY);
|
||||
List<File> annotationsPath = compilerConfiguration.get(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY);
|
||||
if (classpath != null) {
|
||||
for (File path : classpath) {
|
||||
addToClasspath(path);
|
||||
|
||||
@@ -105,7 +105,7 @@ public class ReplInterpreter {
|
||||
|
||||
List<URL> classpath = Lists.newArrayList();
|
||||
|
||||
for (File file : configuration.get(JVMConfigurationKeys.CLASSPATH_KEY)) {
|
||||
for (File file : configuration.getList(JVMConfigurationKeys.CLASSPATH_KEY)) {
|
||||
try {
|
||||
classpath.add(file.toURI().toURL());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user