Renamed methods getUserData and putUserData to get and put, respectively.
This commit is contained in:
@@ -66,8 +66,8 @@ public class BytecodeCompiler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||||
configuration.putUserData(JVMConfigurationKeys.CLASSPATH_KEY, classpathItems.toArray(new File[classpathItems.size()]));
|
configuration.put(JVMConfigurationKeys.CLASSPATH_KEY, classpathItems.toArray(new File[classpathItems.size()]));
|
||||||
configuration.putUserData(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, new File[] {PathUtil.getJdkAnnotationsPath()});
|
configuration.put(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, new File[] {PathUtil.getJdkAnnotationsPath()});
|
||||||
|
|
||||||
JetCoreEnvironment environment = new JetCoreEnvironment(CompileEnvironmentUtil.createMockDisposable(), configuration
|
JetCoreEnvironment environment = new JetCoreEnvironment(CompileEnvironmentUtil.createMockDisposable(), configuration
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -163,8 +163,8 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments, K2JVMComp
|
|||||||
@NotNull
|
@NotNull
|
||||||
private static CompilerConfiguration createCompilerConfiguration(@NotNull K2JVMCompilerArguments arguments) {
|
private static CompilerConfiguration createCompilerConfiguration(@NotNull K2JVMCompilerArguments arguments) {
|
||||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||||
configuration.putUserData(JVMConfigurationKeys.CLASSPATH_KEY, getClasspath(arguments).toArray(new File[0]));
|
configuration.put(JVMConfigurationKeys.CLASSPATH_KEY, getClasspath(arguments).toArray(new File[0]));
|
||||||
configuration.putUserData(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, getAnnotationsPath(arguments).toArray(new File[0]));
|
configuration.put(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, getAnnotationsPath(arguments).toArray(new File[0]));
|
||||||
return configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,11 +142,11 @@ public class CompileEnvironmentUtil {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||||
configuration.putUserData(JVMConfigurationKeys.CLASSPATH_KEY, new File[]{
|
configuration.put(JVMConfigurationKeys.CLASSPATH_KEY, new File[]{
|
||||||
PathUtil.findRtJar(),
|
PathUtil.findRtJar(),
|
||||||
PathUtil.getDefaultRuntimePath()
|
PathUtil.getDefaultRuntimePath()
|
||||||
});
|
});
|
||||||
configuration.putUserData(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, new File[]{
|
configuration.put(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, new File[]{
|
||||||
PathUtil.getJdkAnnotationsPath()
|
PathUtil.getJdkAnnotationsPath()
|
||||||
});
|
});
|
||||||
JetCoreEnvironment scriptEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(disposable, configuration);
|
JetCoreEnvironment scriptEnvironment = JetCoreEnvironment.createCoreEnvironmentForJVM(disposable, configuration);
|
||||||
|
|||||||
@@ -168,8 +168,8 @@ public class JetCoreEnvironment extends JavaCoreEnvironment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void configure(@NotNull CompilerConfiguration compilerConfiguration) {
|
public void configure(@NotNull CompilerConfiguration compilerConfiguration) {
|
||||||
File[] classpath = compilerConfiguration.getUserData(JVMConfigurationKeys.CLASSPATH_KEY);
|
File[] classpath = compilerConfiguration.get(JVMConfigurationKeys.CLASSPATH_KEY);
|
||||||
File[] annotationsPath = compilerConfiguration.getUserData(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY);
|
File[] annotationsPath = compilerConfiguration.get(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY);
|
||||||
if (classpath != null) {
|
if (classpath != null) {
|
||||||
for (File path : classpath) {
|
for (File path : classpath) {
|
||||||
addToClasspath(path);
|
addToClasspath(path);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public class ReplInterpreter {
|
|||||||
|
|
||||||
List<URL> classpath = Lists.newArrayList();
|
List<URL> classpath = Lists.newArrayList();
|
||||||
|
|
||||||
for (File file : configuration.getUserData(JVMConfigurationKeys.CLASSPATH_KEY)) {
|
for (File file : configuration.get(JVMConfigurationKeys.CLASSPATH_KEY)) {
|
||||||
try {
|
try {
|
||||||
classpath.add(file.toURI().toURL());
|
classpath.add(file.toURI().toURL());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
public class CompilerConfiguration {
|
public class CompilerConfiguration {
|
||||||
private final UserDataHolderBase holder = new UserDataHolderBase();
|
private final UserDataHolderBase holder = new UserDataHolderBase();
|
||||||
|
|
||||||
public <T> T getUserData(@NotNull Key<T> key) {
|
public <T> T get(@NotNull Key<T> key) {
|
||||||
return holder.getUserData(key);
|
return holder.getUserData(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> void putUserData(@NotNull Key<T> key, @Nullable T value) {
|
public <T> void put(@NotNull Key<T> key, @Nullable T value) {
|
||||||
holder.putUserData(key, value);
|
holder.putUserData(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ public class CompileCompilerDependenciesTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||||
configuration.putUserData(JVMConfigurationKeys.CLASSPATH_KEY, classpath.toArray(new File[classpath.size()]));
|
configuration.put(JVMConfigurationKeys.CLASSPATH_KEY, classpath.toArray(new File[classpath.size()]));
|
||||||
configuration.putUserData(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, annotationsPath);
|
configuration.put(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, annotationsPath);
|
||||||
return configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ public class ReplInterpreterTest {
|
|||||||
private void testFile(@NotNull String relativePath) {
|
private void testFile(@NotNull String relativePath) {
|
||||||
CompilerConfiguration configuration =
|
CompilerConfiguration configuration =
|
||||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(ConfigurationKind.JDK_ONLY, TestJdkKind.FULL_JDK);
|
CompileCompilerDependenciesTest.compilerConfigurationForTests(ConfigurationKind.JDK_ONLY, TestJdkKind.FULL_JDK);
|
||||||
File[] classpath = configuration.getUserData(JVMConfigurationKeys.CLASSPATH_KEY);
|
File[] classpath = configuration.get(JVMConfigurationKeys.CLASSPATH_KEY);
|
||||||
assert classpath != null;
|
assert classpath != null;
|
||||||
configuration.putUserData(JVMConfigurationKeys.CLASSPATH_KEY, ArrayUtil.append(classpath, new File("out/production/runtime")));
|
configuration.put(JVMConfigurationKeys.CLASSPATH_KEY, ArrayUtil.append(classpath, new File("out/production/runtime")));
|
||||||
ReplInterpreter repl = new ReplInterpreter(disposable, configuration);
|
ReplInterpreter repl = new ReplInterpreter(disposable, configuration);
|
||||||
|
|
||||||
ReplSessionTestFile file = ReplSessionTestFile.load(new File("compiler/testData/repl/" + relativePath));
|
ReplSessionTestFile file = ReplSessionTestFile.load(new File("compiler/testData/repl/" + relativePath));
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class PsiUtilsTest {
|
|||||||
System.setProperty("java.awt.headless", "true")
|
System.setProperty("java.awt.headless", "true")
|
||||||
|
|
||||||
val configuration = CompilerConfiguration()
|
val configuration = CompilerConfiguration()
|
||||||
configuration.putUserData(JVMConfigurationKeys.CLASSPATH_KEY, array(PathUtil.findRtJar()))
|
configuration.put(JVMConfigurationKeys.CLASSPATH_KEY, array(PathUtil.findRtJar()))
|
||||||
environment = JetCoreEnvironment(rootDisposable, configuration)
|
environment = JetCoreEnvironment(rootDisposable, configuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user