diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java index b96758d6632..81a13679807 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java @@ -365,6 +365,9 @@ public class KotlinTestUtils { else if (jdkKind == TestJdkKind.FULL_JDK_9) { configuration.put(JVMConfigurationKeys.JDK_HOME, getJdk9Home()); } + else if (jdkKind == TestJdkKind.FULL_JDK_15) { + configuration.put(JVMConfigurationKeys.JDK_HOME, getJdk15Home()); + } else if (SystemInfo.IS_AT_LEAST_JAVA9) { configuration.put(JVMConfigurationKeys.JDK_HOME, new File(System.getProperty("java.home"))); } @@ -408,6 +411,15 @@ public class KotlinTestUtils { return new File(jdk11); } + @NotNull + public static File getJdk15Home() { + String jdk15 = System.getenv("JDK_15"); + if (jdk15 == null) { + throw new AssertionError("Environment variable JDK_15 is not set!"); + } + return new File(jdk15); + } + public static void resolveAllKotlinFiles(KotlinCoreEnvironment environment) throws IOException { List roots = ContentRootsKt.getKotlinSourceRoots(environment.getConfiguration()); if (roots.isEmpty()) return; @@ -669,7 +681,7 @@ public class KotlinTestUtils { public static boolean compileJavaFilesExternallyWithJava9(@NotNull Collection files, @NotNull List options) { List command = new ArrayList<>(); - command.add(new File(getJdk9Home(), "bin/javac").getPath()); + command.add(new File(jdkHome, "bin/javac").getPath()); command.addAll(options); for (File file : files) { command.add(file.getPath()); diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestJdkKind.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestJdkKind.java index 35d3e901642..fa450d20f1c 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestJdkKind.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestJdkKind.java @@ -26,6 +26,8 @@ public enum TestJdkKind { FULL_JDK_6, // JDK found at $JDK_19 FULL_JDK_9, + // JDK found at $JDK_15 + FULL_JDK_15, // JDK found at java.home FULL_JDK, ANDROID_API,