How to get the dependency information about public static final fields

39 views Asked by At

Though jdeps can be used to get the class level dependencies, considering follow case:

A.java:

public class A {
    public static final int AA = 1;
}

B.java

public class B {
    public static void main(String[] args) {
        System.out.println(A.AA);
    }
}

In this case, when using javac to do the complilation. The A.AA in B.java will be directly replaced by constant 1.

In this case, jdeps can not find that B actually depends on A. How to find the dependency information when it comes to this kind of public static final field accessing?

0

There are 0 answers