diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-04-05 08:09:59 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-04-05 17:50:48 +0200 |
commit | 19de5d97efbb80e9767bc6b873bcc2c263a721de (patch) | |
tree | d38fa0adfc3b6caaa85f8380b46f4736af5fef2a /configure.ac | |
parent | 7c5ca44c48b05ba73defd48057a82db7dc833e0c (diff) |
Allow building against JDK 18
...where ExternalProject_hsqldb failed with
> [java] java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
> [java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194)
> [java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:891)
> [java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:231)
> [java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
> [java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
> [java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
> [java] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
> [java] at java.base/java.lang.reflect.Method.invoke(Method.java:577)
> [java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
> [java] at org.apache.tools.ant.Task.perform(Task.java:350)
> [java] at org.apache.tools.ant.Target.execute(Target.java:449)
> [java] at org.apache.tools.ant.Target.performTasks(Target.java:470)
> [java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
> [java] at org.apache.tools.ant.Project.executeTarget(Project.java:1374)
> [java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> [java] at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
> [java] at org.apache.tools.ant.Main.runBuild(Main.java:818)
> [java] at org.apache.tools.ant.Main.startAnt(Main.java:223)
> [java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
> [java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
> [java] Caused by: java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
> [java] at java.base/java.lang.System.setSecurityManager(System.java:416)
> [java] at org.apache.tools.ant.types.Permissions.setSecurityManager(Permissions.java:103)
> [java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:216)
> [java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:155)
> [java] ... 19 more
while building target switchtojdk17 (but then unfortunately carried on, without
the source modifications that should have been done by that target, leading to
confusing errors like
> [javac] workdir/UnpackedTarball/hsqldb/src/org/hsqldb/jdbc/jdbcConnection.java:426: error: jdbcConnection is not abstract and does not override abstract method createStruct(String,Object[]) in Connection
that should have been under control at least ever since
7dbfc0012cc75e7dac9a416b53149ad8ec33f071 "make hsqldb build with java 1.7".)
Unconditionally passing ANT_OPTS -Djava.security.manager=allow would cause older
JDK versions (like Java 11) to fail with a java.lang.Error "Could not create
SecurityManager" caused by a java.lang.ClassNotFoundException "allow", so
introduce JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD.
This should allow us to keep building against at least JDK 18, even though later
versions of Java may remove the Security Manager completely, but in which case
hopefully an updated version of Apache Ant will become available.
Change-Id: I9d143d8bcfff67870017bb1c874eec53e0ff9672
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132558
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 91fb52cb1a2c..af0c9937d865 100644 --- a/configure.ac +++ b/configure.ac @@ -5774,6 +5774,7 @@ if test "$cross_compiling" = "yes"; then JAVA_HOME JAVAIFLAGS JDK + JDK_SECURITYMANAGER_DISALLOWED LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER @@ -8594,6 +8595,7 @@ dnl =================================================================== # Whether all the complexity here actually is needed any more or not, no idea. +JDK_SECURITYMANAGER_DISALLOWED= if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then _gij_longver=0 AC_MSG_CHECKING([the installed JDK]) @@ -8620,6 +8622,12 @@ if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then if test "$_jdk_ver" -gt 10900; then JAVA_CLASSPATH_NOT_SET=TRUE fi + dnl TODO: Presumably, the Security Manager will not merely be disallowed, but be + dnl completely removed in some Java version > 18 (see + dnl <https://openjdk.java.net/jeps/411> "Deprecate the Security Manager for Removal"): + if test "$_jdk_ver" -ge 180000; then + JDK_SECURITYMANAGER_DISALLOWED=TRUE + fi JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"` if test "$_os" = "WINNT"; then @@ -8928,6 +8936,7 @@ if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then JAVA_HOME_FOR_BUILD=$JAVA_HOME JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS JDK_FOR_BUILD=$JDK + JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD=$JDK_SECURITYMANAGER_DISALLOWED fi AC_SUBST(JAVACFLAGS) @@ -8940,6 +8949,7 @@ AC_SUBST(JAVA_HOME) AC_SUBST(JAVA_HOME_FOR_BUILD) AC_SUBST(JDK) AC_SUBST(JDK_FOR_BUILD) +AC_SUBST(JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD) AC_SUBST(JAVA_SOURCE_VER) AC_SUBST(JAVA_TARGET_VER) |