RFR [JDK8]: 7153951: -Xlint:auxiliaryclass

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Sep 24 08:28:50 PDT 2012


Nitpick question - it seems like this new lint warning is mainly a 
workaround to overcome problems triggered with javac's implicit 
compilation policy - is this enough to warrant the Lint status, as 
opposed to it just being an internal compiler flag?

Perhaps, if we wanted a more general Lint warning we could expand the 
scope of the new warning a bit, by defining a bunch of subvalues i.e. 
-Xlint:auxiliaryclass[decl, use, use-other]

where meaning of names (names TBD ;-)) is as follows:

*) decl - warns about auxiliary class declaration
*) use - always warns about use of auxiliary classes regardless of source
*) use-other - warns about use of auxiliary classes from a different 
source from the one in which they are declared

Maurizio

On 24/09/12 13:01, Fredrik Öhrström wrote:
> From the bug text:
> 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 "auxiliary classes".
>
> http://cr.openjdk.java.net/~ohrstrom/webrev-7153951-v4/ 
> <http://cr.openjdk.java.net/%7Eohrstrom/webrev-7153951-v1/>
>
> There are 499 auxiliary classes in the openjdk, but only 16 of
> these are used in such a way that they cannot be found using the
> -sourcepath option, ie they break implicit compilation.
>
> The -Xlint:auxiliaryclass reports all references to those 16 classes.
>
> Allowing the developer to either move the reference into the same
> source file as the auxiliary class, or break out the auxiliary class into
> a separate source file.
>
> //Fredrik




More information about the compiler-dev mailing list