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 /external/hsqldb | |
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 'external/hsqldb')
-rw-r--r-- | external/hsqldb/ExternalProject_hsqldb.mk | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/external/hsqldb/ExternalProject_hsqldb.mk b/external/hsqldb/ExternalProject_hsqldb.mk index 4d5f5f8786f0..67ae75106bc2 100644 --- a/external/hsqldb/ExternalProject_hsqldb.mk +++ b/external/hsqldb/ExternalProject_hsqldb.mk @@ -13,10 +13,17 @@ $(eval $(call gb_ExternalProject_register_targets,hsqldb,\ build \ )) +# ANT_OPTS -Djava.security.manager=allow allows latest Apache Ant 1.10.12 to still run under +# Java 18, where java.lang.System.setSecurityManager (as called from +# org.apache.tools.ant.types.Permissions.setSecurityManager) would otherwise throw an +# UnsupportedOperationException (see <https://openjdk.java.net/jeps/411> "Deprecate the Security +# Manager for Removal"): $(call gb_ExternalProject_get_state_target,hsqldb,build) : $(call gb_Trace_StartRange,hsqldb,EXTERNAL) $(call gb_ExternalProject_run,build,\ JAVA_HOME=$(JAVA_HOME_FOR_BUILD) \ + $(if $(JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD), \ + ANT_OPTS="$$ANT_OPTS -Djava.security.manager=allow") \ $(ICECREAM_RUN) "$(ANT)" \ $(if $(verbose),-v,-q) \ -f build/build.xml \ |