mistriggered "error: warnings found and -Werror specified" for java warnings

Erik Joelsson erik.joelsson at oracle.com
Thu Apr 23 13:12:28 UTC 2020


Hello Matthias,

On 2020-04-23 05:51, Matthias Klose wrote:
> jdk-15+20 fails to build with
>
> * For target support_test_failure_handler_classes__the.BUILD_FAILURE_HANDLER_batch:
> /packages/openjdk/15/openjdk-15-15~20/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java:136:
> warning: [deprecation] finishedTesting() in Observer has been deprecated
>      public void finishedTesting() {
>                  ^
> error: warnings found and -Werror specified
> 1 error
> 1 warning
That's strange. I assume this tool is built with the boot JDK, so that 
makes me wonder what boot JDK you are using as we have not seen this 
warning/error?
>
> Apparently --disable-warnings-as-errors only has an effect on C/C++ files,
> however the build diagnostics trigger on java warnings as well, and apparently
> -Werror is hard-coded in various places for java options. Should the
> documentation for this configure option be clarified, or should it trigger for
> java warnings as well?

Correct. The reasoning is that OpenJDK is built on a wide variety of 
environments with different compiler versions, so keeping the build 
warning free on all of them isn't feasible. This option makes it 
possible to build with all those different compiler versions while still 
maintaining a warning free source for a core set of compiler versions. 
In contrast, the Java code should only be compiled with a very small set 
of javac versions, which should be easily controlled. The majority of 
the code is even compiled with the Javac we are building. We have 
contemplated a similar option for Java code, but concluded that it 
doesn't serve any purpose. The Java source should just always be warning 
free.

/Erik




More information about the build-dev mailing list