On 19. 5. 26 01:10, Johan Corveleyn wrote:
On Tue, May 19, 2026 at 12:53 AM Johan Corveleyn<[email protected]> wrote:
On Mon, May 4, 2026 at 4:19 AM<[email protected]> wrote:
Author: brane
Date: Mon May  4 02:19:20 2026
New Revision: 1933796

Log:
Silence JavaHL compiler warnings about missing bootstrap classpath.
Use the --release option instead of -source and -target if the Java
compiler supports it.

* build/ac-macros/java.m4
   (SVN_FIND_JDK): Check the javac version and adjust flags accordingly.
    If debugging is enabled, silence warnings about the target JVM version
    8 (1.8) being deprecated.

Modified:
    subversion/trunk/build/ac-macros/java.m4

Modified: subversion/trunk/build/ac-macros/java.m4
==============================================================================
--- subversion/trunk/build/ac-macros/java.m4    Mon May  4 00:35:48 2026        
(r1933795)
+++ subversion/trunk/build/ac-macros/java.m4    Mon May  4 02:19:20 2026        
(r1933796)
@@ -166,12 +166,27 @@ AC_DEFUN(SVN_FIND_JDK,
      # The release for "-source" could actually be greater than that
      # of "-target", if we want to cross-compile for lesser JVMs.
      if test -z "$JAVAC_FLAGS"; then
-      JAVAC_FLAGS="-target $JAVA_OLDEST_WORKING_VER -source 1.8"
+      java_version=[`"$JDK/bin/javac" -version 2>&1 | $SED -e 's/^[^0-9]*//' 
-e 's/\.[^.]*$//'`]
+      java_major=[`echo $java_version | $SED -e 's/\.[^.]*$//'`]
+      java_minor=[`echo $java_version | $SED -e 's/^[^.]*\.//'`]
+      if test "$java_major" -eq 1 && test "$java_minor" -lt 9; then
+        JAVAC_FLAGS="-target $JAVA_OLDEST_WORKING_VER -source 1.8"
+      else
+        java_release=[`echo $JAVA_OLDEST_WORKING_VER | $SED -e 's/^[^.]*\.//'`]
+        JAVAC_FLAGS="--release $java_release"
The sed pattern looks a bit tricky to me, it will only work as long as
$JAVA_OLDEST_WORKING_VER is of the form 1.x, or if there would be no
'.' at all.

I see this value is only set in configure.ac:
[[[
# The minimum version for the JVM runtime for our Java bytecode.
JAVA_OLDEST_WORKING_VER='1.8'
# SVN_CHECK_JDK sets $JAVA_CLASSPATH
SVN_CHECK_JDK($JAVA_OLDEST_WORKING_VER)
]]]

I suppose whoever updates this someday will put '11' or '21' in there,
and not '11.0' or somesuch, but who knows.

Maybe (only converting 1.x to x):
     java_release=[`echo $JAVA_OLDEST_WORKING_VER | $SED -e 's/^1\.//'`]
?

+      fi
+
        if test "$enable_debugging" = "yes"; then
          JAVAC_FLAGS="-g -Xlint -Xlint:unchecked -Xlint:serial -Xlint:path 
$JAVAC_FLAGS"
          if test -z "$JAVAC_COMPAT_FLAGS"; then
            JAVAC_COMPAT_FLAGS="$JAVAC_FLAGS -Xlint:-unchecked -Xlint:-deprecation 
-Xlint:-dep-ann -Xlint:-rawtypes"
          fi
+      else
+        dnl Ignore warnings about deprecated version 8 (from --release 8)
+        JAVAC_FLAGS="-Xlint:options"
+        if test -z "$JAVAC_COMPAT_FLAGS"; then
+          JAVAC_COMPAT_FLAGS="$JAVAC_FLAGS"
+        fi
I'm a bit confused. In the commit message you said: "If debugging is
enabled, silence warnings about the target JVM version 8 (1.8) being
deprecated.". But the change above is in the else branch of checking
for $enable_debugging. Did you mean to say "If debugging is *not*
enabled" in your commit message?

Or ... IIUC -Xlint:options does warn about problems with command line
options. From "javac --help-lint" (with openjdk 21):
     options              Warn about issues relating to use of command
line options.

So perhaps here you intentionally enable warnings for "options" when
debugging is not enabled (and leave it to the recommended lint options
+ (unchecked, serial, path) if debugging is enabled)?
Ah, upon further crawling through the backport proposals I saw you
changed this some more in r1933877. After that, I think it makes more
sense. Still, I'd like to understand whether you wanted to suppress
this warning for debug (as your commit message of r1933796 seems to
say) or for non-debug mode (as r1933877 seems to implement) :-).

I should probably have gone back in time and fixed the log message...

-- Brane

Reply via email to