Currently the -Werror flag will cause compilations to fail if any warnings are emitted. This enhancement proposes a configuration flag that makes specific lint categories errors.
It might look similar to the `Xlint:[-]key(,[-]key)*` flag, where the following compilation would report all supported warnings but only fail if unchecked or rawtypes warnings were present:
javac -Xlint:all -Werror:unchecked,rawtypes ...
In general, the use-case for this is getting the benefit of -Werror for specific warnings, without having to clean up all warnings in a codebase.
One specific use-case is sunapi diagnostics (see JDK-8349846). Since sunapi is intended to be a 'mandatory' unsuppressible diagnostic it is not possible to use -Werror in compilations with any sunapi warnings, this feature would allow enabling some warnings as errors in a compilation where sunapi warnings were present.
It might look similar to the `Xlint:[-]key(,[-]key)*` flag, where the following compilation would report all supported warnings but only fail if unchecked or rawtypes warnings were present:
javac -Xlint:all -Werror:unchecked,rawtypes ...
In general, the use-case for this is getting the benefit of -Werror for specific warnings, without having to clean up all warnings in a codebase.
One specific use-case is sunapi diagnostics (see JDK-8349846). Since sunapi is intended to be a 'mandatory' unsuppressible diagnostic it is not possible to use -Werror in compilations with any sunapi warnings, this feature would allow enabling some warnings as errors in a compilation where sunapi warnings were present.
- blocks
-
JDK-8349846 [REDO] [REDO] 'internal proprietary API' diagnostics if --system is configured to an earlier JDK version
-
- Open
-
- csr for
-
JDK-8350044 Support configuring individual lint categories as errors
-
- Draft
-
- links to
-
Review(master) openjdk/jdk/23622