diff --git a/compiler/testData/mockJDK9/jre/lib/annotations.jar b/compiler/testData/mockJDK9/jre/lib/annotations.jar new file mode 100644 index 00000000000..b78e2de180d Binary files /dev/null and b/compiler/testData/mockJDK9/jre/lib/annotations.jar differ diff --git a/compiler/testData/mockJDK9/jre/lib/rt.jar b/compiler/testData/mockJDK9/jre/lib/rt.jar new file mode 100644 index 00000000000..e5ffffef95b Binary files /dev/null and b/compiler/testData/mockJDK9/jre/lib/rt.jar differ diff --git a/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java b/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java index b3d86cc69dc..0a5e93abcd4 100644 --- a/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java +++ b/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.idea.test; import com.intellij.openapi.projectRoots.JavaSdk; import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.projectRoots.impl.JavaSdkImpl; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; import org.jetbrains.annotations.NotNull; @@ -39,6 +40,12 @@ public class PluginTestCaseBase { return KotlinTestUtils.getHomeDirectory() + TEST_DATA_PROJECT_RELATIVE; } + @NotNull + @TestOnly + private static Sdk createMockJdk(@NotNull String name, String path) { + return ((JavaSdkImpl)JavaSdk.getInstance()).createMockJdk(name, path, false); + } + @NotNull private static Sdk getSdk(String sdkHome, String name) { return JavaSdk.getInstance().createJdk(name, sdkHome, true); @@ -49,6 +56,12 @@ public class PluginTestCaseBase { return getSdk("compiler/testData/mockJDK/jre", "Mock JDK"); } + @TestOnly + @NotNull + public static Sdk mockJdk9() { + return createMockJdk("9", "compiler/testData/mockJDK9/jre"); + } + @NotNull public static Sdk fullJdk() { String javaHome = System.getProperty("java.home");