The meaning of -Xlint:none,serial

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Mar 21 12:27:32 UTC 2025


I always assumed what you assumed :-)

E.g. _all_ is a special markers which selects all, _none_ one that 
selects nothing. From there you can remove (in the first case) or add 
(in the second case).

If it doesn't work like that, I'd say that's a bug.

Maurizio

On 20/03/2025 20:16, Archie Cobbs wrote:
> What is the intended meaning of a javac flag like -Xlint:none,serial 
> (where you might replace "serial" with any other non-mandatory lint 
> category).
>
> I always assumed that this means "Disable all lint categories, and 
> then enable the "serial" category". And in fact, that's how it works 
> for mandatory lint categories like "unchecked".
>
> But for non-mandatory lint categories, what it actually means is 
> "Disable all lint categories, period." (which happens here 
> <https://github.com/openjdk/jdk/blob/56038fb5a156568cce2e80f5db18b10ad61c06e4/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L370> 
> and here 
> <https://github.com/openjdk/jdk/blob/56038fb5a156568cce2e80f5db18b10ad61c06e4/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L722>). 
>
>
> Is that intended? It seems surprising, and is asymmetrical with the 
> meaning of -Xlint:all,-serial, which means the converse "Enable all 
> lint categories, and then disable the "serial" category".
>
> Thanks,
> -Archie
>
> -- 
> Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20250321/1b5a962f/attachment-0001.htm>


More information about the compiler-dev mailing list