Consider this trivial setup:
public class Class1 {
static Class2 c;
}
public class Class2 {
static Class3 c;
}
public class Class3 {
}
Here Class1 depends on Class2 (and Object of course) and Class2 depends on Class3. So if I run "jdeps -verbose:class Class1.class" I would expect to see Class2 and Object listed, but instead I get:
Class1.class -> java.base
Class1 -> java.lang.Object java.base
no mention of Class2! If I then add the "-R" option which is supposed to perform a recursive analysis I then get:
Class1.class -> java.base
Class1.class -> not found
Class1 -> Class2 not found
Class1 -> java.lang.Object java.base
so now I see all the classes I would have expected, but this is not what I expect from a "recursive analysis".
If I do the same experiment with jdeps from JDK8u322 I see the same limited output for the non-recursive case, but the recursive case does actually work as (kind of) expected. It seems to recurse into all the JRE jarfiles which is somewhat unexpected but does initially show:
Class1.class -> .
Class1.class -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64/jre/lib/rt.jar
Class1 (Class1.class)
-> Class2 .
-> java.lang.Object
. -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64/jre/lib/rt.jar
Class2 (.)
-> Class3 .
-> java.lang.Object
Class3 (.)
-> java.lang.Object
jce.jar -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64/jre/lib/rt.jar
javax.crypto.BadPaddingException (jce.jar)
...
public class Class1 {
static Class2 c;
}
public class Class2 {
static Class3 c;
}
public class Class3 {
}
Here Class1 depends on Class2 (and Object of course) and Class2 depends on Class3. So if I run "jdeps -verbose:class Class1.class" I would expect to see Class2 and Object listed, but instead I get:
Class1.class -> java.base
Class1 -> java.lang.Object java.base
no mention of Class2! If I then add the "-R" option which is supposed to perform a recursive analysis I then get:
Class1.class -> java.base
Class1.class -> not found
Class1 -> Class2 not found
Class1 -> java.lang.Object java.base
so now I see all the classes I would have expected, but this is not what I expect from a "recursive analysis".
If I do the same experiment with jdeps from JDK8u322 I see the same limited output for the non-recursive case, but the recursive case does actually work as (kind of) expected. It seems to recurse into all the JRE jarfiles which is somewhat unexpected but does initially show:
Class1.class -> .
Class1.class -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64/jre/lib/rt.jar
Class1 (Class1.class)
-> Class2 .
-> java.lang.Object
. -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64/jre/lib/rt.jar
Class2 (.)
-> Class3 .
-> java.lang.Object
Class3 (.)
-> java.lang.Object
jce.jar -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64/jre/lib/rt.jar
javax.crypto.BadPaddingException (jce.jar)
...