You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by "gemmellr (via GitHub)" <gi...@apache.org> on 2025/10/17 17:13:20 UTC

[PR] Enable support for Java 25 [activemq-artemis]

gemmellr opened a new pull request, #5976:
URL: https://github.com/apache/activemq-artemis/pull/5976

   This is not complete, so I am not referencing the related Jira, and the commits are not final. Will mark as draft as a result.
   
   This is being raised early only as a means of allowing reference to it in a dev-list discussion, concerning the changes current behaviour of imposing requirement to use JDK25 to create releases (whilst everything still runs on JDK17+, and still also builds on JDK17+ outside of performing the release).
   
   Though not actually complete, it does already pass the updated PR checks/tests jobs and a full run of the test suite on JDK25 (*tests are now minus some bits the changes disable on JDK25, since they cant work on JDK25...e.g karaf tests, some compatibility test combinations with older brokers).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact



Re: [PR] Enable support for Java 25 [activemq-artemis]

Posted by "john9x (via GitHub)" <gi...@apache.org>.
john9x commented on code in PR #5976:
URL: https://github.com/apache/activemq-artemis/pull/5976#discussion_r2440709023


##########
artemis-commons/src/main/java25/org/apache/activemq/artemis/utils/sm/SecurityManagerShim.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.utils.sm;
+
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CompletionException;
+
+import javax.security.auth.Subject;
+
+public class SecurityManagerShim {
+
+   // TODO: Move to Subject specific class?
+   public static Subject currentSubject() {
+      return Subject.current();
+   }
+
+   // TODO: Move to Subject specific class?
+   public static <T> T callAs(final Subject subject, final Callable<T> callable) throws CompletionException {
+      Objects.requireNonNull(callable);
+
+      return Subject.callAs(subject, callable);
+   }
+
+   public static boolean isSecurityManagerEnabled() {
+      return false; // It was removed in Java 24+
+   }
+
+   public static Object getAccessControlContext() {
+      // AccessControlContext is now only useful with a SecurityManager,
+      // which can never be used in Java 24+. Return null so calling
+      // code can determine there is nothing to be do re: SecurityManager.
+      return null;
+   }
+
+   public static<T> T doPrivileged(PrivilegedAction<T> action) {
+      Objects.requireNonNull(action);
+
+      return action.run();
+   }
+
+   public static<T> T doPrivileged(final PrivilegedAction<T> action, final Object context) {
+      Objects.requireNonNull(action);
+
+      return action.run();
+   }
+
+   public static <T> T doPrivileged(final PrivilegedExceptionAction<T> exceptionAction) throws PrivilegedActionException {
+      Objects.requireNonNull(exceptionAction);
+
+      try {
+         return exceptionAction.run();
+      } catch (Exception e) {

Review Comment:
   JDK throws RuntimeException as-is, only checked Exceptions wrapped by PrivilegedActionException



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact



Re: [PR] Enable support for Java 25 [activemq-artemis]

Posted by "gemmellr (via GitHub)" <gi...@apache.org>.
gemmellr commented on code in PR #5976:
URL: https://github.com/apache/activemq-artemis/pull/5976#discussion_r2440740478


##########
artemis-commons/src/main/java25/org/apache/activemq/artemis/utils/sm/SecurityManagerShim.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.utils.sm;
+
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CompletionException;
+
+import javax.security.auth.Subject;
+
+public class SecurityManagerShim {
+
+   // TODO: Move to Subject specific class?
+   public static Subject currentSubject() {
+      return Subject.current();
+   }
+
+   // TODO: Move to Subject specific class?
+   public static <T> T callAs(final Subject subject, final Callable<T> callable) throws CompletionException {
+      Objects.requireNonNull(callable);
+
+      return Subject.callAs(subject, callable);
+   }
+
+   public static boolean isSecurityManagerEnabled() {
+      return false; // It was removed in Java 24+
+   }
+
+   public static Object getAccessControlContext() {
+      // AccessControlContext is now only useful with a SecurityManager,
+      // which can never be used in Java 24+. Return null so calling
+      // code can determine there is nothing to be do re: SecurityManager.
+      return null;
+   }
+
+   public static<T> T doPrivileged(PrivilegedAction<T> action) {
+      Objects.requireNonNull(action);
+
+      return action.run();
+   }
+
+   public static<T> T doPrivileged(final PrivilegedAction<T> action, final Object context) {
+      Objects.requireNonNull(action);
+
+      return action.run();
+   }
+
+   public static <T> T doPrivileged(final PrivilegedExceptionAction<T> exceptionAction) throws PrivilegedActionException {
+      Objects.requireNonNull(exceptionAction);
+
+      try {
+         return exceptionAction.run();
+      } catch (Exception e) {

Review Comment:
   Yep. Per the 'work in progress, only for reference in discussion' commentary, the shim isnt actually complete (most of the work so far was around the tests and class handling etc), hence no API doc yet and various TODOs (admittedly I didn't put one here specifically though). That was simply the minimum initial implementation to make this method compile since PEA declares it throws Exception. Good catch though :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact



Re: [PR] Enable support for Java 25 [activemq-artemis]

Posted by "gemmellr (via GitHub)" <gi...@apache.org>.
gemmellr closed pull request #5976: Enable support for Java 25
URL: https://github.com/apache/activemq-artemis/pull/5976


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact



Re: [PR] Enable support for Java 25 [activemq-artemis]

Posted by "gemmellr (via GitHub)" <gi...@apache.org>.
gemmellr commented on PR #5976:
URL: https://github.com/apache/activemq-artemis/pull/5976#issuecomment-3427341217

   I decided to leave this as it was when discussed. I've raised #5993 targeting a fresh Jira.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact