Skip to content

Commit 5dbaa8f

Browse files
committed
Remove System.security field for JDK 24+
With the removal of the security manager (JEP 486) the System.security field is not used for anything meaningful. Signed-off-by: Theresa Mammarella <[email protected]>
1 parent a32dd87 commit 5dbaa8f

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

jcl/src/java.base/share/classes/java/lang/System.java

+6
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,12 @@ public final class System {
124124
*/
125125
private static Properties systemProperties;
126126

127+
/*[IF JAVA_SPEC_VERSION < 24]*/
127128
/**
128129
* The System default SecurityManager.
129130
*/
130131
private static SecurityManager security;
132+
/*[ENDIF] JAVA_SPEC_VERSION < 24 */
131133

132134
private static volatile Console console;
133135
private static volatile boolean consoleInitialized;
@@ -1085,7 +1087,11 @@ public static String setProperty(String prop, String value) {
10851087
@Deprecated(since="17", forRemoval=true)
10861088
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */
10871089
public static SecurityManager getSecurityManager() {
1090+
/*[IF JAVA_SPEC_VERSION >= 24]*/
1091+
return null;
1092+
/*[ELSE] JAVA_SPEC_VERSION >= 24 */
10881093
return security;
1094+
/*[ENDIF] JAVA_SPEC_VERSION >= 24 */
10891095
}
10901096

10911097
/**

runtime/oti/vmconstantpool.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
502502
<!-- Static method references needed to support VirtualThread/Continuation. -->
503503
<staticmethodref class="jdk/internal/vm/Continuation" name="enter" signature="(Ljdk/internal/vm/Continuation;)V" versions="19-"/>
504504
<!-- Security manager check -->
505-
<staticfieldref class="java/lang/System" name="security" signature="Ljava/lang/SecurityManager;"/>
505+
<staticfieldref class="java/lang/System" name="security" signature="Ljava/lang/SecurityManager;" versions="8-23"/>
506506

507507
<!-- VM constants in java -->
508508
<staticfieldref class="com/ibm/oti/vm/VM" name="J9_GC_WRITE_BARRIER_TYPE" signature="I"/>

runtime/vm/resolvesupport.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ isMethodHandleINL(U_8 *methodName, U_16 methodNameLength)
160160
UDATA
161161
packageAccessIsLegal(J9VMThread *currentThread, J9Class *targetClass, j9object_t protectionDomain, UDATA canRunJavaCode)
162162
{
163+
#if JAVA_SPEC_VERSION >= 24
164+
return TRUE;
165+
#else /* JAVA_SPEC_VERSION >= 24 */
163166
UDATA legal = FALSE;
164167
j9object_t security = J9VMJAVALANGSYSTEM_SECURITY(currentThread, J9VMCONSTANTPOOL_CLASSREF_AT(currentThread->javaVM, J9VMCONSTANTPOOL_JAVALANGSYSTEM)->value);
165168
if (NULL == security) {
@@ -175,6 +178,7 @@ packageAccessIsLegal(J9VMThread *currentThread, J9Class *targetClass, j9object_t
175178
}
176179
}
177180
return legal;
181+
#endif /* JAVA_SPEC_VERSION >= 24 */
178182
}
179183

180184
BOOLEAN

0 commit comments

Comments
 (0)