RFR: JDK-8149110 Introduce DISABLED_WARNINGS for Java compilation

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Thu Mar 12 10:21:27 UTC 2020


For native code, we have a system to turn of individual warnings on a 
per-library basis. We should have a similar system for Java compilation.

The suggestion is to introduce a DISABLED_WARNINGS argument to 
SetupJavaCompilation. We could then be able to express something like:

jdk.xml.ws_DISABLED_WARNINGS := rawtypes deprecation finally

to get the jdk.xml.ws module to compile with 
'-Xlint:all,-rawtypes,-deprecation,-finally'

On top of that, I have made sure that all Java compilations are done 
with '-Xlint:all -Werror', and individual warnings are disabled on a 
per-compilation basis. I have checked existing exceptions (using 
-Xlint:-foo), and if they were not needed anymore, I have removed them.

Here's a list of the remaining sinners, with one or more warnings disabled.
  * Multiple demos (really! Aren't they supposed to be role models for 
how to code Java? :-o)
  * Multiple build tools (interim langtools, jigsaw tools, and various 
jdk build tools)
  * jdk.hotspot.agent (almost all possible warnings...)
  * jdk.rmic (deprecation)
  * jdk.scripting.nashorn (removal -- yeah, we know...)
  * jdk.jfr (exports)
  * gensrc for jfr and jvmti
  * visual studio project generator
  * microbenchmark suite (tons of 'em)
  * graal jtreg unit tests

Ideally, these should be fixed for the corresponding Java sources. In 
some cases this might not be possible, and if so, the warnings can 
remain being disabled.

The bug report also mentions:

"As an addition, we can also filter out the annoying:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

and so finally achieve a true warning-free build."

but I've decided to save that part for a separate patch.

Bug: https://bugs.openjdk.java.net/browse/JDK-8149110
WebRev: 
http://cr.openjdk.java.net/~ihse/JDK-8149110-introduce-DISABLE_WARNINGS-for-java/webrev.01

/Magnus



More information about the build-dev mailing list