Extract Java 9 module test about irrelevant jars in JDK home
Skip it on JDKs where ant-javafx.jar is not present.
This commit is contained in:
@@ -19,11 +19,12 @@ class Java9ModulesIntegrationTest : AbstractKotlinCompilerIntegrationTest() {
|
||||
get() = "compiler/testData/javaModules/"
|
||||
|
||||
private fun module(
|
||||
name: String,
|
||||
modulePath: List<File> = emptyList(),
|
||||
addModules: List<String> = emptyList(),
|
||||
additionalKotlinArguments: List<String> = emptyList(),
|
||||
manifest: Manifest? = null
|
||||
name: String,
|
||||
modulePath: List<File> = emptyList(),
|
||||
addModules: List<String> = emptyList(),
|
||||
additionalKotlinArguments: List<String> = emptyList(),
|
||||
manifest: Manifest? = null,
|
||||
checkKotlinOutput: (String) -> Unit = this.checkKotlinOutput(name),
|
||||
): File {
|
||||
val paths = (modulePath + ForTestCompileRuntime.runtimeJarForTests()).joinToString(separator = File.pathSeparator) { it.path }
|
||||
|
||||
@@ -38,21 +39,21 @@ class Java9ModulesIntegrationTest : AbstractKotlinCompilerIntegrationTest() {
|
||||
kotlinOptions += additionalKotlinArguments
|
||||
|
||||
return compileLibrary(
|
||||
name,
|
||||
additionalOptions = kotlinOptions,
|
||||
compileJava = { _, javaFiles, outputDir ->
|
||||
val javaOptions = mutableListOf(
|
||||
"-d", outputDir.path,
|
||||
"--module-path", paths
|
||||
)
|
||||
if (addModules.isNotEmpty()) {
|
||||
javaOptions += "--add-modules"
|
||||
javaOptions += addModules.joinToString()
|
||||
}
|
||||
KotlinTestUtils.compileJavaFilesExternallyWithJava9(javaFiles, javaOptions)
|
||||
},
|
||||
checkKotlinOutput = checkKotlinOutput(name),
|
||||
manifest = manifest
|
||||
name,
|
||||
additionalOptions = kotlinOptions,
|
||||
compileJava = { _, javaFiles, outputDir ->
|
||||
val javaOptions = mutableListOf(
|
||||
"-d", outputDir.path,
|
||||
"--module-path", paths
|
||||
)
|
||||
if (addModules.isNotEmpty()) {
|
||||
javaOptions += "--add-modules"
|
||||
javaOptions += addModules.joinToString()
|
||||
}
|
||||
KotlinTestUtils.compileJavaFilesExternallyWithJava9(javaFiles, javaOptions)
|
||||
},
|
||||
checkKotlinOutput = checkKotlinOutput,
|
||||
manifest = manifest
|
||||
)
|
||||
}
|
||||
|
||||
@@ -274,4 +275,20 @@ class Java9ModulesIntegrationTest : AbstractKotlinCompilerIntegrationTest() {
|
||||
assertEquals("", stderr)
|
||||
assertEquals("OK", stdout)
|
||||
}
|
||||
|
||||
fun testDoNotLoadIrrelevantJarsFromUnnamed() {
|
||||
// This test checks that we don't load irrelevant .jar files from the JDK distribution when resolving JDK dependencies.
|
||||
// Here we're testing that references to symbols from lib/ant-javafx are unresolved, if that file is present.
|
||||
// The test succeeds though even if the file is absent, because it's not guaranteed to be present in JDK.
|
||||
module("main", checkKotlinOutput = {
|
||||
assertTrue(it, it.trimEnd().endsWith("COMPILATION_ERROR"))
|
||||
})
|
||||
}
|
||||
|
||||
fun testDoNotLoadIrrelevantJarsFromNamed() {
|
||||
// See the comment in testDoNotLoadIrrelevantJarsFromUnnamed.
|
||||
module("main", checkKotlinOutput = {
|
||||
assertTrue(it, it.trimEnd().endsWith("COMPILATION_ERROR"))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user