<div dir="ltr">I think --disable-warnings-as-errors is for C++ warnings, not for java warnings like deprecation, you can use<div><div>-Xlint:none to disable the warning.</div></div><div>But this will not prevent the output of deprecation message, the output is like:</div><div>Note: Test.java uses or overrides a deprecated API.<br>Note: Recompile with -Xlint:deprecation for details.<br></div><div>At least there is no more warning message</div><div>There seems no way to configure with this option to javac, you can set environment variable JDK_JAVAC_OPTIONS="-Xlint:none" or JDK_JAVAC_OPTIONS="-Xlint:-deprecation"</div><div>Hope this help.</div><div><br></div><div>Yumin</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 15, 2024 at 8:28 AM S A <<a href="mailto:simeon.danailov.andreev@gmail.com" target="_blank">simeon.danailov.andreev@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi all,</div><div><br></div><div>how do I disable warnings treated as errors during the OpenJDK 19+ build?<br></div><div><br></div><div>In order to better understand changes in behavior between OpenJDK versions, I've been bisecting and compiling OpenJDK 19 and OpenJDK 20 in the recent months.</div><div><br></div><div>One problem that I run into a lot is warnings failing the build. How do I disable this behavior? Due to different work environments, I compile with a few versions of gcc, so the warnings differ based on the gcc version. So far I've been changing the gcc version in order to be able to compile, but this is tiresome.<br></div><div><br></div><div>According to the guide, the behavior can be configured away:<br></div><div><br></div><div><a href="https://openjdk.org/groups/build/doc/building.html" target="_blank">https://openjdk.org/groups/build/doc/building.html</a></div><div><br></div><div>> By default, the JDK has a strict approach where warnings from the compiler is considered errors which fail the build. For very new or very old compiler versions, this can trigger new classes of warnings, which thus fails the build. Run configure with --disable-warnings-as-errors to turn of this behavior. (The warnings will still show, but not make the build fail.)</div><div><br></div><div>Unfortunately, e.g. with OpenJDK 20, the build still fails due to warnings. Has the configuration option changed?</div><div><br></div><div>E.g. using gcc:</div><div><br></div><div>gcc version 10.2.1</div><div><br></div><div>Building at commit:</div><div><br></div><div>commit 388a56e4c4278f2a3da31946b15a45f3aee25e58 (HEAD, tag: jdk-20+20)</div><div><br></div><div>I run into warnings that cause the build to fail:</div><div><br></div><div>ERROR: Build failed for target 'images' in configuration 'linux-x86_64-server-release' (exit code 2) <br><br>=== Output from failing command(s) repeated here ===<br>* For target buildtools_interim_langtools_modules_jdk.compiler.interim__the.BUILD_jdk.compiler.interim_batch:<br>/data/git/jdk/src/jdk.compiler/share/classes/com/sun/tools/javac/file/FSInfo.java:140: warning: [deprecation] URL(URL,String) in URL has been deprecated<br>        URL retVal = new URL(base, input);<br>                     ^<br>error: warnings found and -Werror specified<br>/data/git/jdk/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/Main.java:693: warning: [deprecation] URL(String,String,int,String,URLStreamHandler) in URL has been deprecated<br>                return new URL(PROTOCOL, null, -1, name, handler);<br>                       ^<br>/data/git/jdk/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/ServiceProxy.java:141: warning: [deprecation] URL(URL,String) in URL has been deprecated<br>                URL u = new URL(url, fullName);<br>                        ^<br>1 error<br>3 warnings</div><div><br></div><div>Despite configuration:</div><div><br></div><div>using configure arguments '--disable-warnings-as-errors --with-boot-jdk=/data/jdk/openjdk-20.0.2_linux-x64_bin/jdk-20.0.2/ --with-toolchain-type=gcc'</div><div><br></div><div>Best regards and thanks,</div><div>Simeon<br></div></div>
</blockquote></div>