Fix Java6BuiltInsWithJDKMembersTest

After update of the project to JDK 8, the default JDK at java.home is
now JDK 8. However, this test relied on the fact that the default is JDK
6. Pass the path to the JDK 6 explicitly
This commit is contained in:
Alexander Udalov
2017-03-22 12:26:54 +03:00
parent e4ae7ca4ce
commit 6a049c9ab5
5 changed files with 20 additions and 2 deletions
@@ -468,6 +468,9 @@ public class KotlinTestUtils {
else if (jdkKind == TestJdkKind.ANDROID_API) {
JvmContentRootsKt.addJvmClasspathRoot(configuration, findAndroidApiJar());
}
else if (jdkKind == TestJdkKind.FULL_JDK_6) {
JvmContentRootsKt.addJvmClasspathRoots(configuration, PathUtil.getJdkClassesRoots(System.getenv("JDK_16")));
}
else {
JvmContentRootsKt.addJvmClasspathRoots(configuration, PathUtil.getJdkClassesRoots());
}
@@ -21,6 +21,9 @@ public enum TestJdkKind {
// Differs from common mock JDK only by one additional 'nonExistingMethod' in Collection and constructor from Double in Throwable
// It's needed to test the way we load additional built-ins members that neither in black nor white lists
MODIFIED_MOCK_JDK,
// JDK found at $JDK_16
FULL_JDK_6,
// JDK found at java.home
FULL_JDK,
ANDROID_API,
}
@@ -42,7 +42,10 @@ abstract class AbstractBuiltInsWithJDKMembersTest : KotlinTestWithEnvironment()
})
override fun createEnvironment(): KotlinCoreEnvironment =
createEnvironmentWithJdk(ConfigurationKind.JDK_ONLY, TestJdkKind.FULL_JDK)
createEnvironmentWithJdk(ConfigurationKind.JDK_ONLY, testJdkKind)
protected open val testJdkKind: TestJdkKind
get() = TestJdkKind.FULL_JDK
protected fun doTest(builtinVersionName: String) {
val module = JvmResolveUtil.analyze(environment).moduleDescriptor as ModuleDescriptorImpl
@@ -16,7 +16,11 @@
package org.jetbrains.kotlin.serialization.builtins
import org.jetbrains.kotlin.test.TestJdkKind
class Java6BuiltInsWithJDKMembersTest : AbstractBuiltInsWithJDKMembersTest() {
override val testJdkKind get() = TestJdkKind.FULL_JDK_6
fun testLoadBuiltIns() {
doTest("java6")
}
@@ -153,7 +153,12 @@ public class PathUtil {
@NotNull
public static List<File> getJdkClassesRoots() {
return JavaSdkUtil.getJdkClassesRoots(new File(System.getProperty("java.home")), true);
return getJdkClassesRoots(System.getProperty("java.home"));
}
@NotNull
public static List<File> getJdkClassesRoots(@NotNull String javaHome) {
return JavaSdkUtil.getJdkClassesRoots(new File(javaHome), true);
}
@NotNull