Environment creation unified everywhere.
JDK Kind turned into enum for clarity
This commit is contained in:
@@ -178,13 +178,27 @@ public class JetTestUtils {
|
||||
builtinsScopeExtensionMode);
|
||||
}
|
||||
|
||||
public static JetCoreEnvironment createEnvironmentWithFullJdk(Disposable disposable) {
|
||||
return createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(disposable,
|
||||
ConfigurationKind.ALL, TestJdkKind.FULL_JDK);
|
||||
}
|
||||
|
||||
public static JetCoreEnvironment createEnvironmentWithMockJdkAndIdeaAnnotations(Disposable disposable) {
|
||||
return createEnvironmentWithMockJdkAndIdeaAnnotations(disposable, ConfigurationKind.ALL);
|
||||
}
|
||||
|
||||
public static JetCoreEnvironment createEnvironmentWithMockJdkAndIdeaAnnotations(Disposable disposable, @NotNull ConfigurationKind configurationKind) {
|
||||
return createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(disposable, configurationKind, TestJdkKind.MOCK_JDK);
|
||||
}
|
||||
|
||||
public static JetCoreEnvironment createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(
|
||||
@NotNull Disposable disposable,
|
||||
@NotNull ConfigurationKind configurationKind,
|
||||
@NotNull TestJdkKind jdkKind
|
||||
) {
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(disposable,
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(configurationKind, true)
|
||||
CompileCompilerDependenciesTest
|
||||
.compilerConfigurationForTests(configurationKind, jdkKind)
|
||||
);
|
||||
environment.addToClasspath(getAnnotationsJar());
|
||||
return environment;
|
||||
@@ -198,7 +212,6 @@ public class JetTestUtils {
|
||||
return new File(JetTestCaseBuilder.getHomeDirectory(), "compiler/testData/mockJDK-1.7/jre/lib/annotations.jar");
|
||||
}
|
||||
|
||||
|
||||
public static void mkdirs(File file) throws IOException {
|
||||
if (file.isDirectory()) {
|
||||
return;
|
||||
@@ -255,12 +268,6 @@ public class JetTestUtils {
|
||||
|
||||
public static final Pattern FILE_PATTERN = Pattern.compile("//\\s*FILE:\\s*(.*)$", Pattern.MULTILINE);
|
||||
|
||||
public static JetCoreEnvironment createEnvironmentWithFullJdk(Disposable disposable) {
|
||||
return new JetCoreEnvironment(disposable,
|
||||
CompileCompilerDependenciesTest.compilerConfigurationForTests(ConfigurationKind.ALL, false)
|
||||
);
|
||||
}
|
||||
|
||||
public static PsiFile createFile(@NonNls String name, String text, @NotNull Project project) {
|
||||
LightVirtualFile virtualFile = new LightVirtualFile(name, JetLanguage.INSTANCE, text);
|
||||
virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET);
|
||||
|
||||
Reference in New Issue
Block a user