Skip to content

Commit

Permalink
Merge pull request #20749 from pshipton/allowsm
Browse files Browse the repository at this point in the history
Add java.lang.Access.allowSecurityManager to jdk21
  • Loading branch information
pshipton authored Dec 4, 2024
2 parents 8a8a854 + 7cb76fd commit a0c3031
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions jcl/src/java.base/share/classes/java/lang/Access.java
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,13 @@ public Module addEnableNativeAccess(Module mod) {
return mod.implAddEnableNativeAccess();
}

/*[IF (21 <= JAVA_SPEC_VERSION) & (JAVA_SPEC_VERSION < 24)]*/
@Override
public boolean allowSecurityManager() {
return System.allowSecurityManager();
}
/*[ENDIF] (21 <= JAVA_SPEC_VERSION) & (JAVA_SPEC_VERSION < 24) */

/*[IF JAVA_SPEC_VERSION >= 23]*/
@Override
public boolean addEnableNativeAccess(ModuleLayer moduleLayer, String moduleName) {
Expand All @@ -560,11 +567,6 @@ public void putCharUTF16(byte[] val, int index, int c) {
}

/*[IF JAVA_SPEC_VERSION < 24]*/
@Override
public boolean allowSecurityManager() {
return System.allowSecurityManager();
}

@Override
public long stringConcatHelperPrepend(long indexCoder, byte[] buf, String value) {
return StringConcatHelper.prepend(indexCoder, buf, value);
Expand Down
4 changes: 2 additions & 2 deletions jcl/src/java.base/share/classes/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -1301,11 +1301,11 @@ static void initSecurityManager(ClassLoader applicationClassLoader) {
}
/*[ENDIF] JAVA_SPEC_VERSION >= 9 */

/*[IF JAVA_SPEC_VERSION == 23]*/
/*[IF (21 <= JAVA_SPEC_VERSION) & (JAVA_SPEC_VERSION < 24)]*/
static boolean allowSecurityManager() {
return !throwUOEFromSetSM;
}
/*[ENDIF] JAVA_SPEC_VERSION == 23 */
/*[ENDIF] (21 <= JAVA_SPEC_VERSION) & (JAVA_SPEC_VERSION < 24) */

/**
* Sets the active security manager. Note that once
Expand Down

0 comments on commit a0c3031

Please sign in to comment.