JVM: fix "module reads" check in JavaModuleGraph

There was a bug in the DFS. Whenever we encountered a "requires
transitive X" directive in some module, we recursively invoked DFS not
on X but on `dependencyName`, which is the target module that we're
trying to find the path to. And that always failed, because no module
requires itself.

 #KT-66275 Fixed
This commit is contained in:
Alexander Udalov
2024-03-13 23:17:44 +01:00
committed by Space Team
parent fecc5ba501
commit 94e5cafb61
11 changed files with 68 additions and 1 deletions
@@ -0,0 +1,5 @@
package a;
public class A {
public String ok() { return "OK"; }
}
@@ -0,0 +1,3 @@
module moduleA {
exports a;
}
@@ -0,0 +1,5 @@
package b;
import a.A;
public class B extends A {}
@@ -0,0 +1,4 @@
module moduleB {
requires transitive moduleA;
exports b;
}
@@ -0,0 +1,3 @@
module moduleC {
requires transitive moduleB;
}
@@ -0,0 +1,9 @@
package d;
import b.B;
public class JavaMain {
public static void main(String[] args) {
System.out.println(new B().ok());
}
}
@@ -0,0 +1,7 @@
package d
import b.B
fun main() {
println(B().ok())
}
@@ -0,0 +1,4 @@
module moduleD {
requires kotlin.stdlib;
requires moduleC;
}