[Git][java-team/icedtea-web][master] Fix build errors with JDK 21

Emmanuel Bourg (@ebourg) gitlab at salsa.debian.org
Fri Jul 12 10:32:26 BST 2024



Emmanuel Bourg pushed to branch master at Debian Java Maintainers / icedtea-web


Commits:
5da6a8f0 by Pushkar Kulkarni at 2024-02-14T22:53:23+05:30
Fix build errors with JDK 21

JDK 21 has removed most of the JarIndex functionality and also
made the erstwhile jdk.internal.util.jar.JarIndex class package
private under jdk.jartool/sun.tools.jar. Upstream icedtea-web
has patched this issue by introducing a dummy JarIndex class
which will ensure no compilation issues but will fail at
runtime. This commit adds another patch to support compilation
with JDK 21 in the autoconf scripts (note: upstream removed the
make/autoconf-based build in an unreleased commit).

- - - - -


4 changed files:

- debian/changelog
- + debian/patches/jdk-21-autoconf.patch
- + debian/patches/jdk-21-jarindex.patch
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+icedtea-web (1.8.8-3) unstable; urgency=medium
+
+  * debian/patches: Fix build errors with JDK 21 (Closes: #1052691) 
+
+ -- Pushkar Kulkarni <pushkar.kulkarni at canonical.com>  Thu, 23 Nov 2023 12:46:55 +0530
+
 icedtea-web (1.8.8-2) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/patches/jdk-21-autoconf.patch
=====================================
@@ -0,0 +1,74 @@
+Description: Support compilation with JDK 21
+ Modify autoconf scripts to support compilation with JDK 21.
+ Upstream has removed autoconf/make-based building, but hasn't
+ released it yet. So, this patch need not be forwarded upstream. 
+Author: Pushkar Kulkarni <pushkar.kulkarni at canonical.com>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1052691 
+Forwarded: not-needed
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -846,10 +846,12 @@
+   AC_MSG_RESULT($JAVA_VERSION)
+   if test "${JAVA_VERSION}" -eq "8"; then
+     HAVE_JAVA8="yes"
++  elif test "$JAVA_VERSION" -ge "21"; then
++    HAVE_JAVA21="yes"
+   elif test "$JAVA_VERSION" -ge "9"; then
+     HAVE_JAVA9="yes"
+   fi
+-  if test -z "$HAVE_JAVA8" -a -z "$HAVE_JAVA9"; then
++  if test -z "$HAVE_JAVA8" -a -z "$HAVE_JAVA9" -a -z "$HAVE_JAVA21"; then
+     AC_MSG_ERROR([JDK8 or newer is required, detected was: $JAVA_VERSION])
+   fi
+   if ! test -z "$HAVE_JAVA8"; then
+@@ -861,6 +863,7 @@
+   AC_SUBST(VERSION_DEFS)
+   AM_CONDITIONAL([HAVE_JAVA8], test x"${HAVE_JAVA8}" = "xyes")
+   AM_CONDITIONAL([HAVE_JAVA9], test x"${HAVE_JAVA9}" = "xyes")
++  AM_CONDITIONAL([HAVE_JAVA21], test x"${HAVE_JAVA21}" = "xyes")
+ ])
+ 
+ AC_DEFUN_ONCE([IT_FIND_KEYTOOL],
+--- a/configure.ac
++++ b/configure.ac
+@@ -149,11 +149,14 @@
+ dnl IT575 - Plugin depends on com.sun/jndi.toolkit.url.UrlUtil
+ dnl IT576 - Plugin depends on sun.applet.AppletImageRef
+ dnl IT578 - Remove need for patching AppletPanel for Plugin/Webstart
+-if test x"$HAVE_JAVA9" = xyes ; then
++if test x"$HAVE_JAVA9" = xyes -o x"$HAVE_JAVA21" = xyes ; then
+   JAVA_BASE=java.base
+   JAVA_DESKTOP=java.desktop
+   JAVA_NAMING=java.naming
+ fi
++if test x"$HAVE_JAVA21" = xyes ; then
++  JDK_JARTOOL=jdk.jartool
++fi
+ IT_CHECK_FOR_CLASS(JAVA_NET_COOKIEMANAGER, [java.net.CookieManager], [some.pkg], [])
+ IT_CHECK_FOR_CLASS(JAVA_NET_HTTPCOOKIE, [java.net.HttpCookie], [some.pkg], [])
+ IT_CHECK_FOR_CLASS(JAVA_NET_COOKIEHANDLER, [java.net.CookieHandler], [some.pkg], [])
+@@ -163,13 +166,17 @@
+ IT_CHECK_FOR_CLASS(SUN_SECURITY_X509_X500NAME, [sun.security.x509.X500Name], [some.pkg], [$JAVA_BASE])
+ IT_CHECK_FOR_CLASS(SUN_SECURITY_ACTION_GETPROPERTYACTION, [sun.security.action.GetPropertyAction], [some.pkg], [$JAVA_BASE])
+ # the classname cant be substitued by variable, as it is substituted to inner class
+-if test x"$HAVE_JAVA9" = xyes ; then
++if test x"$HAVE_JAVA21" = xyes ; then
+   IT_CHECK_FOR_CLASS(HEXDUMPENCODER, [sun.security.util.HexDumpEncoder], [some.pkg], [$JAVA_BASE])
+-  IT_CHECK_FOR_CLASS(SUN_MISC_JARINDEX, [jdk.internal.util.jar.JarIndex], [some.pkg], [$JAVA_BASE])
+ else
+-  IT_CHECK_FOR_CLASS(HEXDUMPENCODER, [sun.misc.HexDumpEncoder], [some.pkg], [$JAVA_BASE])
+-  IT_CHECK_FOR_CLASS(SUN_MISC_JARINDEX, [sun.misc.JarIndex], [some.pkg], [$JAVA_BASE])
+-  IT_CHECK_FOR_CLASS(SUN_MISC_LAUNCHER, [sun.misc.Launcher], [some.pkg], [$JAVA_BASE])
++  if test x"$HAVE_JAVA9" = xyes ; then
++    IT_CHECK_FOR_CLASS(HEXDUMPENCODER, [sun.security.util.HexDumpEncoder], [some.pkg], [$JAVA_BASE])
++    IT_CHECK_FOR_CLASS(SUN_MISC_JARINDEX, [jdk.internal.util.jar.JarIndex], [some.pkg], [$JAVA_BASE])
++  else
++    IT_CHECK_FOR_CLASS(HEXDUMPENCODER, [sun.misc.HexDumpEncoder], [some.pkg], [$JAVA_BASE])
++    IT_CHECK_FOR_CLASS(SUN_MISC_JARINDEX, [sun.misc.JarIndex], [some.pkg], [$JAVA_BASE])
++    IT_CHECK_FOR_CLASS(SUN_MISC_LAUNCHER, [sun.misc.Launcher], [some.pkg], [$JAVA_BASE])
++  fi
+ fi
+ IT_CHECK_FOR_CLASS(SUN_SECURITY_VALIDATOR_VALIDATOREXCEPTION, [sun.security.validator.ValidatorException], [some.pkg], [$JAVA_BASE])
+ IT_CHECK_FOR_CLASS(SUN_NET_WWW_PROTOCOL_JAR_URLJARFILE, [sun.net.www.protocol.jar.URLJarFile], [some.pkg], [$JAVA_BASE])


=====================================
debian/patches/jdk-21-jarindex.patch
=====================================
@@ -0,0 +1,36 @@
+Description: Support for compilation with JDK 21
+ Adds a dummy implementation of JarIndex to support compilation with JDK 21.
+ Most of the JDK's JarIndex functionality was moved to an internal class.
+Origin: upstream, https://github.com/AdoptOpenJDK/IcedTea-Web/pull/925
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1052691
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/netx/net/sourceforge/jnlp/jdk89acesses/JarIndexAccess.java
++++ b/netx/net/sourceforge/jnlp/jdk89acesses/JarIndexAccess.java
+@@ -28,7 +28,7 @@
+                 jarIndexClass = Class.forName("jdk.internal.util.jar.JarIndex");
+             } catch (ClassNotFoundException exx) {
+                 OutputController.getLogger().log(exx);
+-                throw new RuntimeException("JarIndex not found!");
++                jarIndexClass = JarIndexDummy.class;
+             }
+         }
+     }
+@@ -71,4 +71,17 @@
+         return (LinkedList<String>) o;
+     }
+ 
++    /**
++     * Because starting of JAVA 21 the JarIndex is no longer supported we provide a dummy implementation which always returns {@code null}.
++     */
++    @SuppressWarnings("unused")
++    private static class JarIndexDummy {
++        public static Object getJarIndex(JarFile jar) {
++            return null;
++        }
++
++        public Object get(String fileName) {
++            return null;
++        }
++    }
+ }


=====================================
debian/patches/series
=====================================
@@ -6,3 +6,5 @@ java11-compatibility.diff
 reproducible-documentation.patch
 remove-pack200-support.patch
 build-with-java17.diff
+jdk-21-autoconf.patch
+jdk-21-jarindex.patch



View it on GitLab: https://salsa.debian.org/java-team/icedtea-web/-/commit/5da6a8f072ece9178511f4837e32addd4208b227

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/java-team/icedtea-web/-/commit/5da6a8f072ece9178511f4837e32addd4208b227
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20240712/5c35d702/attachment.htm>


More information about the pkg-java-commits mailing list