Minor, return a set in JavaModuleGraph.getAllDependencies
To prevent duplicate roots to be added
This commit is contained in:
@@ -191,8 +191,7 @@ internal class ClasspathRootsResolver(
|
|||||||
else -> computeDefaultRootModules() + additionalModules
|
else -> computeDefaultRootModules() + additionalModules
|
||||||
}
|
}
|
||||||
|
|
||||||
val allDependencies = javaModuleGraph.getAllDependencies(rootModules).toMutableList()
|
val allDependencies = javaModuleGraph.getAllDependencies(rootModules)
|
||||||
|
|
||||||
if (allDependencies.any { moduleName -> javaModuleFinder.findModule(moduleName) is JavaModule.Automatic }) {
|
if (allDependencies.any { moduleName -> javaModuleFinder.findModule(moduleName) is JavaModule.Automatic }) {
|
||||||
// According to java.lang.module javadoc, if at least one automatic module is added to the module graph,
|
// According to java.lang.module javadoc, if at least one automatic module is added to the module graph,
|
||||||
// all observable automatic modules should be added.
|
// all observable automatic modules should be added.
|
||||||
|
|||||||
+3
-3
@@ -22,8 +22,8 @@ class JavaModuleGraph(finder: JavaModuleFinder) {
|
|||||||
private val module: (String) -> JavaModule? =
|
private val module: (String) -> JavaModule? =
|
||||||
LockBasedStorageManager.NO_LOCKS.createMemoizedFunctionWithNullableValues(finder::findModule)
|
LockBasedStorageManager.NO_LOCKS.createMemoizedFunctionWithNullableValues(finder::findModule)
|
||||||
|
|
||||||
fun getAllDependencies(moduleNames: List<String>): List<String> {
|
fun getAllDependencies(moduleNames: List<String>): LinkedHashSet<String> {
|
||||||
val visited = moduleNames.toMutableSet()
|
val visited = LinkedHashSet(moduleNames)
|
||||||
|
|
||||||
// Every module implicitly depends on java.base
|
// Every module implicitly depends on java.base
|
||||||
visited += "java.base"
|
visited += "java.base"
|
||||||
@@ -55,7 +55,7 @@ class JavaModuleGraph(finder: JavaModuleFinder) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return visited.toList()
|
return visited
|
||||||
}
|
}
|
||||||
|
|
||||||
fun reads(moduleName: String, dependencyName: String): Boolean {
|
fun reads(moduleName: String, dependencyName: String): Boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user