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

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Thu Apr 23 14:05:11 UTC 2020

> 23 apr. 2020 kl. 15:50 skrev Igor Ignatyev <igor.ignatyev at oracle.com>:
>> On Apr 23, 2020, at 6:12 AM, Erik Joelsson <erik.joelsson at oracle.com> wrote:
>> 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?
> I guess version of jtreg/jt-harness is more relevant here as deprecated finishedTesting is from com.sun.javatest.Harness.Observer.

Aha, that’s probably the explanation. I recently removed deprecation as a disabled warning for the failure handler. If it depends on jtreg, and it has changed deprecation status, that might trigger a compilation warning.

I’m on mobile now and can’t check how this should be resolved. 

If a newer version of jtreg introduced the depreciation, we should fix our sources. If this is something only present in older sources (?) we might need to raise the minimum jtreg version. 


> --Igor
>>> 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 jdk-dev mailing list