8344336: SM cleanup of java.lang.System, Runtime, String, StackWalker

Reviewed-by: dfuchs, alanb, lancea
This commit is contained in:
Roger Riggs 2024-11-21 21:50:41 +00:00
parent 0f458e2c3e
commit c199f5326b
6 changed files with 14 additions and 219 deletions

View file

@ -174,11 +174,6 @@ public class Runtime {
* @see #halt(int)
*/
public void exit(int status) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkExit(status);
}
Shutdown.exit(status);
}
@ -232,11 +227,6 @@ public class Runtime {
* @since 1.3
*/
public void addShutdownHook(Thread hook) {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new RuntimePermission("shutdownHooks"));
}
ApplicationShutdownHooks.add(hook);
}
@ -259,11 +249,6 @@ public class Runtime {
* @since 1.3
*/
public boolean removeShutdownHook(Thread hook) {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new RuntimePermission("shutdownHooks"));
}
return ApplicationShutdownHooks.remove(hook);
}
@ -293,11 +278,6 @@ public class Runtime {
* @since 1.3
*/
public void halt(int status) {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkExit(status);
}
Shutdown.beforeHalt();
Shutdown.halt(status);
}
@ -779,11 +759,6 @@ public class Runtime {
}
void load0(Class<?> fromClass, String filename) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkLink(filename);
}
File file = new File(filename);
if (!file.isAbsolute()) {
throw new UnsatisfiedLinkError(
@ -840,11 +815,6 @@ public class Runtime {
}
void loadLibrary0(Class<?> fromClass, String libname) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkLink(libname);
}
if (libname.indexOf((int)File.separatorChar) != -1) {
throw new UnsatisfiedLinkError(
"Directory separator should not appear in library name: " + libname);