Improve automatic module handling in module graph construction

Add all automatic modules to roots if at least one automatic module is
added, as per
http://cr.openjdk.java.net/~mr/jigsaw/spec/api/java/lang/module/package-summary.html
This commit is contained in:
Alexander Udalov
2017-06-30 18:03:17 +03:00
parent c428505d4d
commit 9199023952
11 changed files with 57 additions and 3 deletions
@@ -198,4 +198,19 @@ class Java9ModulesIntegrationTest : AbstractKotlinCompilerIntegrationTest() {
module("main", listOf(m1, m2))
}
fun testUnnamedAgainstSeveralAutomatic() {
val a = module("autoA")
val b = module("autoB")
// Even though we only add autoA to the module graph, autoB should be added as well because autoA, being automatic,
// transitively requires every other automatic module, and in particular, autoB.
// Furthermore, because autoB is automatic, main should read autoB
module("main", listOf(a, b), addModules = listOf("autoA"))
}
fun testNamedAgainstSeveralAutomatic() {
val a = module("autoA")
val b = module("autoB")
module("main", listOf(a, b))
}
}