config_host.mk.in                         |    1 +
 configure.ac                              |   11 +++++++++++
 external/hsqldb/ExternalProject_hsqldb.mk |    2 ++
 3 files changed, 14 insertions(+)

New commits:
commit 541eacf801b111594b380afd27aa33ee7648e708
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Mon Mar 3 17:02:36 2025 +0100
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Tue Mar 4 11:43:20 2025 +0100

    Reinstate the JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD workaround
    
    ...for Java versions < 24.  As discussed in the comments starting at
    
<https://gerrit.libreoffice.org/c/core/+/132558/4#message-4fd391160f395455362289909dadb7d2663f4ff2>
    "Allow building against JDK 18", the previous
    35d9ec3e596bce2ea35ed3b6418e0ba672a61443 "Remove the
    JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD workaround" had started to 
resurface
    the old "exception and build failure with JDK 21/22/23 on macOS Sequoia."
    
    So keep the workaround for Java versions < 24, and hope that we won't run 
into
    scenarios where we combine a Java version >= 24 (for which the workaround 
would
    cause the new build failure) with an Ant version that requires the 
workaround.
    
    Change-Id: Ib886f68d5c17ace2384f22672dcc2d0478830228
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182454
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>
    Tested-by: Jenkins

diff --git a/config_host.mk.in b/config_host.mk.in
index deafc48737d3..2ab62f748bd6 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -382,6 +382,7 @@ export JAVA_TARGET_VER=@JAVA_TARGET_VER@
 export JAWTLIB=@JAWTLIB@
 export JDK=@JDK@
 export JDK_FOR_BUILD=@JDK_FOR_BUILD@
+export 
JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD=@JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD@
 export JFREEREPORT_JAR=@JFREEREPORT_JAR@
 export JITC_PROCESSOR_TYPE=@JITC_PROCESSOR_TYPE@
 JOM=@JOM@
diff --git a/configure.ac b/configure.ac
index 37dff9cb0d54..be6d72fe237a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6236,6 +6236,7 @@ if test "$cross_compiling" = "yes"; then
         JAVA_HOME
         JAVAIFLAGS
         JDK
+        JDK_SECURITYMANAGER_DISALLOWED
         LIBO_BIN_FOLDER
         LIBO_LIB_FOLDER
         LIBO_URE_LIB_FOLDER
@@ -9080,6 +9081,7 @@ dnl 
===================================================================
 
 # Whether all the complexity here actually is needed any more or not, no idea.
 
+JDK_SECURITYMANAGER_DISALLOWED=
 MODULAR_JAVA=
 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
     _gij_longver=0
@@ -9104,6 +9106,13 @@ if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != 
"yes"; then
             if test "$_jdk_ver" -lt 10800; then
                 AC_MSG_ERROR([JDK is too old, you need at least 8 ($_jdk_ver < 
10800)])
             fi
+            dnl The Security Manager is disallowed since Java 18 (see
+            dnl <https://openjdk.java.net/jeps/411> "Deprecate the Security 
Manager for Removal")
+            dnl and completely removed since Java 24 (see
+            dnl <https://openjdk.org/jeps/486> "JEP 486: Permanently Disable 
the Security Manager"):
+            if test "$_jdk_ver" -ge 180000 && test "$_jdk_ver" -lt 240000; then
+                JDK_SECURITYMANAGER_DISALLOWED=TRUE
+            fi
 
             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
             if test "$_os" = "WINNT"; then
@@ -9413,6 +9422,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)
@@ -9424,6 +9434,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)
 AC_SUBST(MODULAR_JAVA)
diff --git a/external/hsqldb/ExternalProject_hsqldb.mk 
b/external/hsqldb/ExternalProject_hsqldb.mk
index a3dfcade6b87..4e5c750c7f3c 100644
--- a/external/hsqldb/ExternalProject_hsqldb.mk
+++ b/external/hsqldb/ExternalProject_hsqldb.mk
@@ -22,6 +22,8 @@ $(call gb_ExternalProject_get_state_target,hsqldb,build) :
        $(call gb_Trace_StartRange,hsqldb,EXTERNAL)
        $(call gb_ExternalProject_run,build,\
                unset MSYS_NO_PATHCONV && 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 \

Reply via email to