Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/java.base/share/classes/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public static void setSecurityManager(@SuppressWarnings("removal") SecurityManag
if (allowSecurityManager()) {
System.err.println("WARNING: java.lang.System::setSecurityManager" +
" is deprecated and will be removed in a future release.");
setSecurityManagerDirect(sm);
implSetSecurityManager(sm);
} else {
// security manager not allowed
if (sm != null) {
Expand All @@ -377,8 +377,7 @@ public static void setSecurityManager(@SuppressWarnings("removal") SecurityManag
}
}

private static void setSecurityManagerDirect(
@SuppressWarnings("removal") SecurityManager sm) {
private static void implSetSecurityManager(@SuppressWarnings("removal") SecurityManager sm) {
if (security == null) {
// ensure image reader is initialized
Object.class.getResource("java/lang/ANY");
Expand Down Expand Up @@ -2161,7 +2160,7 @@ private static void initPhase3() {
break;
case "":
case "default":
setSecurityManagerDirect(new SecurityManager());
implSetSecurityManager(new SecurityManager());
allowSecurityManager = MAYBE;
needWarning = true;
break;
Expand All @@ -2181,7 +2180,7 @@ private static void initPhase3() {
// custom security manager may be in non-exported package
ctor.setAccessible(true);
SecurityManager sm = (SecurityManager) ctor.newInstance();
setSecurityManagerDirect(sm);
implSetSecurityManager(sm);
needWarning = true;
} catch (Exception e) {
throw new InternalError("Could not create SecurityManager", e);
Expand Down