Initial proof of concept for implementation of -Xlint:hiddenclass

Fredrik Öhrström fredrik.ohrstrom at oracle.com
Fri Mar 16 05:12:10 PDT 2012


>From the bug:

Although legal, the use of multiple top level classes in the same file
is somewhat questionable to begin with, but it is particularly bad when
in some package class A in A.java refers to class B defined in C.java. 
This requires that at times the files must be compiled together, and
prevents implicit compilation from locating such "hidden classes".

Proof of concept impl:
http://cr.openjdk.java.net/~ohrstrom/webrev-7153951-v1/

It seems to detect the problem correctly. And there are a few of these
in the jdk, it seems, ~100.

How to do isSameFile test properly?
How to report each hidden class reference only once?
Are line numbers neccesary?
Where to put checkForHiddenAccess?
Does it cover all possible use cases?
What else did I miss?

//Fredrik




More information about the compiler-dev mailing list