Initial proof of concept for implementation of -Xlint:hiddenclass

Fredrik Öhrström fredrik.ohrstrom at
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 refers to class B defined in 
This requires that at times the files must be compiled together, and
prevents implicit compilation from locating such "hidden classes".

Proof of concept impl:

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?


More information about the compiler-dev mailing list