8338411: Implement JEP 486: Permanently Disable the Security Manager

Co-authored-by: Sean Mullan <mullan@openjdk.org>
Co-authored-by: Alan Bateman <alanb@openjdk.org>
Co-authored-by: Weijun Wang <weijun@openjdk.org>
Co-authored-by: Aleksei Efimov <aefimov@openjdk.org>
Co-authored-by: Brian Burkhalter <bpb@openjdk.org>
Co-authored-by: Daniel Fuchs <dfuchs@openjdk.org>
Co-authored-by: Harshitha Onkar <honkar@openjdk.org>
Co-authored-by: Joe Wang <joehw@openjdk.org>
Co-authored-by: Jorn Vernee <jvernee@openjdk.org>
Co-authored-by: Justin Lu <jlu@openjdk.org>
Co-authored-by: Kevin Walls <kevinw@openjdk.org>
Co-authored-by: Lance Andersen <lancea@openjdk.org>
Co-authored-by: Naoto Sato <naoto@openjdk.org>
Co-authored-by: Roger Riggs <rriggs@openjdk.org>
Co-authored-by: Brent Christian <bchristi@openjdk.org>
Co-authored-by: Stuart Marks <smarks@openjdk.org>
Co-authored-by: Ian Graves <igraves@openjdk.org>
Co-authored-by: Phil Race <prr@openjdk.org>
Co-authored-by: Erik Gahlin <egahlin@openjdk.org>
Co-authored-by: Jaikiran Pai <jpai@openjdk.org>
Reviewed-by: kevinw, aivanov, rriggs, lancea, coffeys, dfuchs, ihse, erikj, cjplummer, coleenp, naoto, mchung, prr, weijun, joehw, azvegint, psadhukhan, bchristi, sundar, attila
This commit is contained in:
Sean Mullan 2024-11-12 17:16:15 +00:00
parent c12b386d19
commit db85090553
1885 changed files with 5528 additions and 65650 deletions

View file

@ -2177,11 +2177,6 @@ public final class Formatter implements Closeable, Flushable {
* zero size; otherwise, a new file will be created. The output
* will be written to the file and is buffered.
*
* @throws SecurityException
* If a security manager is present and {@link
* SecurityManager#checkWrite checkWrite(fileName)} denies write
* access to the file
*
* @throws FileNotFoundException
* If the given file name does not denote an existing, writable
* regular file and a new regular file of that name cannot be
@ -2217,11 +2212,6 @@ public final class Formatter implements Closeable, Flushable {
* created, or if some other error occurs while opening or
* creating the file
*
* @throws SecurityException
* If a security manager is present and {@link
* SecurityManager#checkWrite checkWrite(fileName)} denies write
* access to the file
*
* @throws UnsupportedEncodingException
* If the named charset is not supported
*/
@ -2256,11 +2246,6 @@ public final class Formatter implements Closeable, Flushable {
* created, or if some other error occurs while opening or
* creating the file
*
* @throws SecurityException
* If a security manager is present and {@link
* SecurityManager#checkWrite checkWrite(fileName)} denies write
* access to the file
*
* @throws UnsupportedEncodingException
* If the named charset is not supported
*/
@ -2291,11 +2276,6 @@ public final class Formatter implements Closeable, Flushable {
* @throws IOException
* if an I/O error occurs while opening or creating the file
*
* @throws SecurityException
* If a security manager is present and {@link
* SecurityManager#checkWrite checkWrite(fileName)} denies write
* access to the file
*
* @throws NullPointerException
* if {@code fileName} or {@code charset} is {@code null}.
*
@ -2323,11 +2303,6 @@ public final class Formatter implements Closeable, Flushable {
* a new file will be created. The output will be written to the
* file and is buffered.
*
* @throws SecurityException
* If a security manager is present and {@link
* SecurityManager#checkWrite checkWrite(file.getPath())} denies
* write access to the file
*
* @throws FileNotFoundException
* If the given file object does not denote an existing, writable
* regular file and a new regular file of that name cannot be
@ -2363,11 +2338,6 @@ public final class Formatter implements Closeable, Flushable {
* created, or if some other error occurs while opening or
* creating the file
*
* @throws SecurityException
* If a security manager is present and {@link
* SecurityManager#checkWrite checkWrite(file.getPath())} denies
* write access to the file
*
* @throws UnsupportedEncodingException
* If the named charset is not supported
*/
@ -2402,11 +2372,6 @@ public final class Formatter implements Closeable, Flushable {
* created, or if some other error occurs while opening or
* creating the file
*
* @throws SecurityException
* If a security manager is present and {@link
* SecurityManager#checkWrite checkWrite(file.getPath())} denies
* write access to the file
*
* @throws UnsupportedEncodingException
* If the named charset is not supported
*/
@ -2437,11 +2402,6 @@ public final class Formatter implements Closeable, Flushable {
* @throws IOException
* if an I/O error occurs while opening or creating the file
*
* @throws SecurityException
* If a security manager is present and {@link
* SecurityManager#checkWrite checkWrite(file.getPath())} denies
* write access to the file
*
* @throws NullPointerException
* if {@code file} or {@code charset} is {@code null}.
*

View file

@ -1168,10 +1168,6 @@ public final class Locale implements Cloneable, Serializable {
* this instance of the Java Virtual Machine. This does not affect the
* host locale.
* <p>
* If there is a security manager, its {@code checkPermission}
* method is called with a {@code PropertyPermission("user.language", "write")}
* permission before the default locale is changed.
* <p>
* The Java Virtual Machine sets the default locale during startup
* based on the host environment. It is used by many locale-sensitive
* methods if no locale is explicitly specified.
@ -1184,13 +1180,8 @@ public final class Locale implements Cloneable, Serializable {
* By setting the default locale with this method, all of the default
* locales for each Category are also set to the specified default locale.
*
* @throws SecurityException
* if a security manager exists and its
* {@code checkPermission} method doesn't allow the operation.
* @throws NullPointerException if {@code newLocale} is null
* @param newLocale the new default locale
* @see SecurityManager#checkPermission
* @see java.util.PropertyPermission
*/
public static synchronized void setDefault(Locale newLocale) {
setDefault(Category.DISPLAY, newLocale);
@ -1203,10 +1194,6 @@ public final class Locale implements Cloneable, Serializable {
* Category for this instance of the Java Virtual Machine. This does
* not affect the host locale.
* <p>
* If there is a security manager, its checkPermission method is called
* with a PropertyPermission("user.language", "write") permission before
* the default locale is changed.
* <p>
* The Java Virtual Machine sets the default locale during startup based
* on the host environment. It is used by many locale-sensitive methods
* if no locale is explicitly specified.
@ -1218,11 +1205,7 @@ public final class Locale implements Cloneable, Serializable {
*
* @param category the specified category to set the default locale
* @param newLocale the new default locale
* @throws SecurityException if a security manager exists and its
* checkPermission method doesn't allow the operation.
* @throws NullPointerException if category and/or newLocale is null
* @see SecurityManager#checkPermission(java.security.Permission)
* @see PropertyPermission
* @see #getDefault(Locale.Category)
* @since 1.7
*/

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,29 +48,15 @@ import sun.security.util.SecurityConstants;
* signify a wildcard match. For example: "java.*" and "*" signify a wildcard
* match, while "*java" and "a*b" do not.
* <P>
* The actions to be granted are passed to the constructor in a string containing
* The actions are passed to the constructor in a string containing
* a list of one or more comma-separated keywords. The possible keywords are
* "read" and "write". Their meaning is defined as follows:
*
* <DL>
* <DT> read
* <DD> read permission. Allows {@code System.getProperty} to
* be called.
* <DT> write
* <DD> write permission. Allows {@code System.setProperty} to
* be called.
* </DL>
* "read" and "write".
* <P>
* The actions string is converted to lowercase before processing.
* <P>
* Care should be taken before granting code permission to access
* certain system properties. For example, granting permission to
* access the "java.home" system property gives potentially malevolent
* code sensitive information about the system environment (the Java
* installation directory). Also, granting permission to access
* the "user.name" and "user.home" system properties gives potentially
* malevolent code sensitive information about the user environment
* (the user's account name and home directory).
*
* @apiNote
* This permission cannot be used for controlling access to resources
* as the Security Manager is no longer supported.
*
* @see java.security.BasicPermission
* @see java.security.Permission
@ -78,7 +64,6 @@ import sun.security.util.SecurityConstants;
* @see java.security.PermissionCollection
* @see java.lang.SecurityManager
*
*
* @author Roland Schemers
* @since 1.2
*

View file

@ -944,9 +944,6 @@ public abstract class ResourceBundle {
* @param module the module for which the resource bundle is searched
* @throws NullPointerException
* if {@code baseName} or {@code module} is {@code null}
* @throws SecurityException
* if a security manager exists and the caller is not the specified
* module and doesn't have {@code RuntimePermission("getClassLoader")}
* @throws MissingResourceException
* if no resource bundle for the specified base name can be found in the
* specified module
@ -997,9 +994,6 @@ public abstract class ResourceBundle {
* @throws NullPointerException
* if {@code baseName}, {@code targetLocale}, or {@code module} is
* {@code null}
* @throws SecurityException
* if a security manager exists and the caller is not the specified
* module and doesn't have {@code RuntimePermission("getClassLoader")}
* @throws MissingResourceException
* if no resource bundle for the specified base name and locale can
* be found in the specified {@code module}
@ -3134,10 +3128,6 @@ public abstract class ResourceBundle {
* reason.
* @throws ExceptionInInitializerError
* if the initialization provoked by this method fails.
* @throws SecurityException
* If a security manager is present and creation of new
* instances is denied. See {@link Class#newInstance()}
* for details.
* @throws IOException
* if an error occurred when reading resources using
* any I/O operations

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -362,15 +362,6 @@ import jdk.internal.reflect.Reflection;
*
* </ul>
*
* <h2> Security </h2>
*
* <p> Service loaders always execute in the security context of the caller
* of the iterator or stream methods and may also be restricted by the security
* context of the caller that created the service loader.
* Trusted system code should typically invoke the methods in this class, and
* the methods of the iterators which they return, from within a privileged
* security context.
*
* <h2> Concurrency </h2>
*
* <p> Instances of this class are not safe for use by multiple concurrent

View file

@ -725,11 +725,7 @@ public abstract class TimeZone implements Serializable, Cloneable {
* of the {@code user.timezone} property.
*
* @param zone the new default {@code TimeZone}, or null
* @throws SecurityException if the security manager's {@code checkPermission}
* denies {@code PropertyPermission("user.timezone",
* "write")}
* @see #getDefault
* @see PropertyPermission
*/
public static void setDefault(TimeZone zone)
{

View file

@ -156,14 +156,6 @@ public interface ExecutorService extends Executor, AutoCloseable {
* <p>This method does not wait for previously submitted tasks to
* complete execution. Use {@link #awaitTermination awaitTermination}
* to do that.
*
* @throws SecurityException if a security manager exists and
* shutting down this ExecutorService may manipulate
* threads that the caller is not permitted to modify
* because it does not hold {@link
* java.lang.RuntimePermission}{@code ("modifyThread")},
* or the security manager's {@code checkAccess} method
* denies access.
*/
void shutdown();
@ -182,13 +174,6 @@ public interface ExecutorService extends Executor, AutoCloseable {
* task that fails to respond to interrupts may never terminate.
*
* @return list of tasks that never commenced execution
* @throws SecurityException if a security manager exists and
* shutting down this ExecutorService may manipulate
* threads that the caller is not permitted to modify
* because it does not hold {@link
* java.lang.RuntimePermission}{@code ("modifyThread")},
* or the security manager's {@code checkAccess} method
* denies access.
*/
List<Runnable> shutdownNow();
@ -397,13 +382,6 @@ public interface ExecutorService extends Executor, AutoCloseable {
* The default implementation invokes {@code shutdown()} and waits for tasks
* to complete execution with {@code awaitTermination}.
*
* @throws SecurityException if a security manager exists and
* shutting down this ExecutorService may manipulate
* threads that the caller is not permitted to modify
* because it does not hold {@link
* java.lang.RuntimePermission}{@code ("modifyThread")},
* or the security manager's {@code checkAccess} method
* denies access.
* @since 19
*/
@Override

View file

@ -38,7 +38,6 @@ package java.util.concurrent;
import static java.lang.ref.Reference.reachabilityFence;
import java.lang.ref.Cleaner.Cleanable;
import java.security.AccessControlContext;
import java.security.AccessControlException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
@ -373,9 +372,7 @@ public class Executors {
/**
* Returns a default thread factory used to create new threads.
* This factory creates all new threads used by an Executor in the
* same {@link ThreadGroup}. If there is a {@link
* java.lang.SecurityManager}, it uses the group of {@link
* System#getSecurityManager}, else the group of the thread
* same {@link ThreadGroup}. It uses the group of the thread
* invoking this {@code defaultThreadFactory} method. Each new
* thread is created as a non-daemon thread with priority set to
* the smaller of {@code Thread.NORM_PRIORITY} and the maximum
@ -391,26 +388,20 @@ public class Executors {
}
/**
* Returns a thread factory used to create new threads that
* have the same permissions as the current thread.
* Returns a thread factory used to create new threads that have
* the current context class loader as the context class loader.
*
* This factory creates threads with the same settings as {@link
* Executors#defaultThreadFactory}, additionally setting the
* AccessControlContext and contextClassLoader of new threads to
* contextClassLoader of new threads to
* be the same as the thread invoking this
* {@code privilegedThreadFactory} method. A new
* {@code privilegedThreadFactory} can be created within an
* {@link AccessController#doPrivileged AccessController.doPrivileged}
* action setting the current thread's access control context to
* create threads with the selected permission settings holding
* within that action.
* {@code privilegedThreadFactory} method.
*
* <p>Note that while tasks running within such threads will have
* the same access control and class loader settings as the
* current thread, they need not have the same {@link
* java.lang.ThreadLocal} or {@link
* java.lang.InheritableThreadLocal} values. If necessary,
* particular values of thread locals can be set or reset before
* any task runs in {@link ThreadPoolExecutor} subclasses using
* <p>Note that while tasks running within such threads will have the
* same class loader as the current thread, they need not have the same
* {@link ThreadLocal} or {@link InheritableThreadLocal} values. If
* necessary, particular values of thread locals can be set or reset
* before any task runs in {@link ThreadPoolExecutor} subclasses using
* {@link ThreadPoolExecutor#beforeExecute(Thread, Runnable)}.
* Also, if it is necessary to initialize worker threads to have
* the same InheritableThreadLocal settings as some other
@ -419,16 +410,14 @@ public class Executors {
* others that will inherit its values.
*
* @return a thread factory
* @throws AccessControlException if the current access control
* context does not have permission to both get and set context
* class loader
*
* @deprecated This method is only useful in conjunction with
* {@linkplain SecurityManager the Security Manager}, which is
* deprecated and subject to removal in a future release.
* Consequently, this method is also deprecated and subject to
* removal. There is no replacement for the Security Manager or this
* method.
* @deprecated This method originally returned a thread factory that
* created new threads that had the same access control context
* as the current thread. Access control contexts were
* only useful in conjunction with
* {@linkplain SecurityManager the Security Manager}, which is no
* longer supported. There is no replacement for the Security Manager
* or this method.
*/
@Deprecated(since="17", forRemoval=true)
public static ThreadFactory privilegedThreadFactory() {
@ -496,24 +485,20 @@ public class Executors {
/**
* Returns a {@link Callable} object that will, when called,
* execute the given {@code callable} under the current access
* control context. This method should normally be invoked within
* an {@link AccessController#doPrivileged AccessController.doPrivileged}
* action to create callables that will, if possible, execute
* under the selected permission settings holding within that
* action; or if not possible, throw an associated {@link
* AccessControlException}.
* execute the given {@code callable} and return its result.
*
* @param callable the underlying task
* @param <T> the type of the callable's result
* @return a callable object
* @throws NullPointerException if callable null
*
* @deprecated This method is only useful in conjunction with
* {@linkplain SecurityManager the Security Manager}, which is
* deprecated and subject to removal in a future release.
* Consequently, this method is also deprecated and subject to
* removal. There is no replacement for the Security Manager or this
* method.
* @deprecated This method originally returned a {@code Callable} object
* that when called, executed the given {@code callable} under the
* current access control context. Access control contexts were
* only useful in conjunction with
* {@linkplain SecurityManager the Security Manager}, which is no
* longer supported. There is no replacement for the Security Manager
* or this method.
*/
@Deprecated(since="17", forRemoval=true)
public static <T> Callable<T> privilegedCallable(Callable<T> callable) {
@ -524,30 +509,22 @@ public class Executors {
/**
* Returns a {@link Callable} object that will, when called,
* execute the given {@code callable} under the current access
* control context, with the current context class loader as the
* context class loader. This method should normally be invoked
* within an
* {@link AccessController#doPrivileged AccessController.doPrivileged}
* action to create callables that will, if possible, execute
* under the selected permission settings holding within that
* action; or if not possible, throw an associated {@link
* AccessControlException}.
* execute the given {@code callable} with the current context
* class loader as the context class loader.
*
* @param callable the underlying task
* @param <T> the type of the callable's result
* @return a callable object
* @throws NullPointerException if callable null
* @throws AccessControlException if the current access control
* context does not have permission to both set and get context
* class loader
*
* @deprecated This method is only useful in conjunction with
* {@linkplain SecurityManager the Security Manager}, which is
* deprecated and subject to removal in a future release.
* Consequently, this method is also deprecated and subject to
* removal. There is no replacement for the Security Manager or this
* method.
* @deprecated This method originally returned a {@code Callable} object
* that when called, executed the given {@code callable} under the
* current access control context, with the current context class
* loader as the context class loader. Access control contexts were
* only useful in conjunction with
* {@linkplain SecurityManager the Security Manager}, which is no
* longer supported. There is no replacement for the Security Manager
* or this method.
*/
@Deprecated(since="17", forRemoval=true)
public static <T> Callable<T> privilegedCallableUsingCurrentClassLoader(Callable<T> callable) {

View file

@ -159,10 +159,6 @@ import jdk.internal.vm.SharedThreadContainer;
* If no thread factory is supplied via a system property, then the
* common pool uses a factory that uses the system class loader as the
* {@linkplain Thread#getContextClassLoader() thread context class loader}.
* In addition, if a {@link SecurityManager} is present, then
* the common pool uses a factory supplying threads that have no
* {@link Permissions} enabled, and are not guaranteed to preserve
* the values of {@link java.lang.ThreadLocal} variables across tasks.
*
* Upon any error in establishing these settings, default parameters
* are used. It is possible to disable or limit the use of threads in
@ -2849,11 +2845,6 @@ public class ForkJoinPool extends AbstractExecutorService {
* other parameters (see {@link #ForkJoinPool(int,
* ForkJoinWorkerThreadFactory, UncaughtExceptionHandler, boolean,
* int, int, int, Predicate, long, TimeUnit)}).
*
* @throws SecurityException if a security manager exists and
* the caller is not permitted to modify threads
* because it does not hold {@link
* java.lang.RuntimePermission}{@code ("modifyThread")}
*/
public ForkJoinPool() {
this(Math.min(MAX_CAP, Runtime.getRuntime().availableProcessors()),
@ -2871,10 +2862,6 @@ public class ForkJoinPool extends AbstractExecutorService {
* @param parallelism the parallelism level
* @throws IllegalArgumentException if parallelism less than or
* equal to zero, or greater than implementation limit
* @throws SecurityException if a security manager exists and
* the caller is not permitted to modify threads
* because it does not hold {@link
* java.lang.RuntimePermission}{@code ("modifyThread")}
*/
public ForkJoinPool(int parallelism) {
this(parallelism, defaultForkJoinWorkerThreadFactory, null, false,
@ -2903,10 +2890,6 @@ public class ForkJoinPool extends AbstractExecutorService {
* @throws IllegalArgumentException if parallelism less than or
* equal to zero, or greater than implementation limit
* @throws NullPointerException if the factory is null
* @throws SecurityException if a security manager exists and
* the caller is not permitted to modify threads
* because it does not hold {@link
* java.lang.RuntimePermission}{@code ("modifyThread")}
*/
public ForkJoinPool(int parallelism,
ForkJoinWorkerThreadFactory factory,
@ -2988,10 +2971,6 @@ public class ForkJoinPool extends AbstractExecutorService {
* or if maximumPoolSize is less than parallelism,
* of if the keepAliveTime is less than or equal to zero.
* @throws NullPointerException if the factory is null
* @throws SecurityException if a security manager exists and
* the caller is not permitted to modify threads
* because it does not hold {@link
* java.lang.RuntimePermission}{@code ("modifyThread")}
* @since 9
*/
public ForkJoinPool(int parallelism,
@ -3285,10 +3264,6 @@ public class ForkJoinPool extends AbstractExecutorService {
* #commonPool()} and parallelism level was set by System
* property {@systemProperty
* java.util.concurrent.ForkJoinPool.common.parallelism}.
* @throws SecurityException if a security manager exists and
* the caller is not permitted to modify threads
* because it does not hold {@link
* java.lang.RuntimePermission}{@code ("modifyThread")}
* @since 19
*/
public int setParallelism(int size) {
@ -3692,11 +3667,6 @@ public class ForkJoinPool extends AbstractExecutorService {
* already shut down. Tasks that are in the process of being
* submitted concurrently during the course of this method may or
* may not be rejected.
*
* @throws SecurityException if a security manager exists and
* the caller is not permitted to modify threads
* because it does not hold {@link
* java.lang.RuntimePermission}{@code ("modifyThread")}
*/
public void shutdown() {
checkPermission();
@ -3717,10 +3687,6 @@ public class ForkJoinPool extends AbstractExecutorService {
* (unlike the case for some other Executors).
*
* @return an empty list
* @throws SecurityException if a security manager exists and
* the caller is not permitted to modify threads
* because it does not hold {@link
* java.lang.RuntimePermission}{@code ("modifyThread")}
*/
public List<Runnable> shutdownNow() {
checkPermission();
@ -3825,13 +3791,6 @@ public class ForkJoinPool extends AbstractExecutorService {
* execution are not executed. The interrupt status will be
* re-asserted before this method returns.
*
* @throws SecurityException if a security manager exists and
* shutting down this ExecutorService may manipulate
* threads that the caller is not permitted to modify
* because it does not hold {@link
* java.lang.RuntimePermission}{@code ("modifyThread")},
* or the security manager's {@code checkAccess} method
* denies access.
* @since 19
*/
@Override

View file

@ -92,9 +92,8 @@ public class ForkJoinWorkerThread extends Thread {
* pool, and with the given policy for preserving ThreadLocals.
*
* @param group if non-null, the thread group for this
* thread. Otherwise, the thread group is chosen by the security
* manager if present, else set to the current thread's thread
* group.
* thread. Otherwise, the thread group is set to the current thread's
* thread group.
* @param pool the pool this thread works in
* @param preserveThreadLocals if true, always preserve the values of
* ThreadLocal variables across tasks; otherwise they may be cleared.
@ -236,19 +235,11 @@ public class ForkJoinWorkerThread extends Thread {
*/
static final class InnocuousForkJoinWorkerThread extends ForkJoinWorkerThread {
/** The ThreadGroup for all InnocuousForkJoinWorkerThreads */
private static final ThreadGroup innocuousThreadGroup;
@SuppressWarnings("removal")
private static final AccessControlContext innocuousACC;
private static final ThreadGroup innocuousThreadGroup = createGroup();
InnocuousForkJoinWorkerThread(ForkJoinPool pool) {
super(innocuousThreadGroup, pool, true, true);
}
@Override @SuppressWarnings("removal")
protected void onStart() {
Thread t = Thread.currentThread();
ThreadLocalRandom.setInheritedAccessControlContext(t, innocuousACC);
}
@Override // to silently fail
public void setUncaughtExceptionHandler(UncaughtExceptionHandler x) { }
@ -258,32 +249,11 @@ public class ForkJoinWorkerThread extends Thread {
throw new SecurityException("setContextClassLoader");
}
@SuppressWarnings("removal")
static AccessControlContext createACC() {
return new AccessControlContext(
new ProtectionDomain[] { new ProtectionDomain(null, null) });
}
static ThreadGroup createGroup() {
ThreadGroup group = Thread.currentThread().getThreadGroup();
for (ThreadGroup p; (p = group.getParent()) != null; )
group = p;
return new ThreadGroup(group, "InnocuousForkJoinWorkerThreadGroup");
}
static {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
@SuppressWarnings("removal")
ThreadGroup g = innocuousThreadGroup =
(sm == null) ? createGroup() :
AccessController.doPrivileged(new PrivilegedAction<>() {
public ThreadGroup run() {
return createGroup(); }});
@SuppressWarnings("removal")
AccessControlContext a = innocuousACC =
(sm == null) ? createACC() :
AccessController.doPrivileged(new PrivilegedAction<>() {
public AccessControlContext run() {
return createACC(); }});
}
}
}

View file

@ -822,8 +822,6 @@ public class ScheduledThreadPoolExecutor
* ContinueExistingPeriodicTasksAfterShutdownPolicy} has been set
* {@code true}, future executions of existing periodic tasks will
* be cancelled.
*
* @throws SecurityException {@inheritDoc}
*/
public void shutdown() {
super.shutdown();
@ -851,7 +849,6 @@ public class ScheduledThreadPoolExecutor
* {@code ScheduledFuture}. For tasks submitted using
* {@link #execute execute}, the element will be a
* zero-delay {@code ScheduledFuture}.
* @throws SecurityException {@inheritDoc}
*/
public List<Runnable> shutdownNow() {
return super.shutdownNow();

View file

@ -294,11 +294,6 @@ public final class ThreadLocalRandom extends Random {
U.putReference(thread, INHERITABLETHREADLOCALS, null);
}
static final void setInheritedAccessControlContext(Thread thread,
@SuppressWarnings("removal") AccessControlContext acc) {
U.putReferenceRelease(thread, INHERITEDACCESSCONTROLCONTEXT, acc);
}
// Serialization support
private static final long serialVersionUID = -5851777807851030925L;
@ -370,8 +365,6 @@ public final class ThreadLocalRandom extends Random {
= U.objectFieldOffset(Thread.class, "threadLocals");
private static final long INHERITABLETHREADLOCALS
= U.objectFieldOffset(Thread.class, "inheritableThreadLocals");
private static final long INHERITEDACCESSCONTROLCONTEXT
= U.objectFieldOffset(Thread.class, "inheritedAccessControlContext");
/** Generates per-thread initialization/probe field */
private static final AtomicInteger probeGenerator = new AtomicInteger();

View file

@ -1385,8 +1385,6 @@ public class ThreadPoolExecutor extends AbstractExecutorService {
* <p>This method does not wait for previously submitted tasks to
* complete execution. Use {@link #awaitTermination awaitTermination}
* to do that.
*
* @throws SecurityException {@inheritDoc}
*/
public void shutdown() {
final ReentrantLock mainLock = this.mainLock;
@ -1416,8 +1414,6 @@ public class ThreadPoolExecutor extends AbstractExecutorService {
* processing actively executing tasks. This implementation
* interrupts tasks via {@link Thread#interrupt}; any task that
* fails to respond to interrupts may never terminate.
*
* @throws SecurityException {@inheritDoc}
*/
public List<Runnable> shutdownNow() {
List<Runnable> tasks;

View file

@ -249,8 +249,6 @@ public class JarFile extends ZipFile {
* it is signed.
* @param name the name of the jar file to be opened for reading
* @throws IOException if an I/O error has occurred
* @throws SecurityException if access to the file is denied
* by the SecurityManager
*/
public JarFile(String name) throws IOException {
this(new File(name), true, ZipFile.OPEN_READ);
@ -263,8 +261,6 @@ public class JarFile extends ZipFile {
* @param verify whether or not to verify the jar file if
* it is signed.
* @throws IOException if an I/O error has occurred
* @throws SecurityException if access to the file is denied
* by the SecurityManager
*/
public JarFile(String name, boolean verify) throws IOException {
this(new File(name), verify, ZipFile.OPEN_READ);
@ -276,8 +272,6 @@ public class JarFile extends ZipFile {
* it is signed.
* @param file the jar file to be opened for reading
* @throws IOException if an I/O error has occurred
* @throws SecurityException if access to the file is denied
* by the SecurityManager
*/
public JarFile(File file) throws IOException {
this(file, true, ZipFile.OPEN_READ);
@ -290,8 +284,6 @@ public class JarFile extends ZipFile {
* @param verify whether or not to verify the jar file if
* it is signed.
* @throws IOException if an I/O error has occurred
* @throws SecurityException if access to the file is denied
* by the SecurityManager.
*/
public JarFile(File file, boolean verify) throws IOException {
this(file, verify, ZipFile.OPEN_READ);
@ -309,8 +301,6 @@ public class JarFile extends ZipFile {
* @throws IOException if an I/O error has occurred
* @throws IllegalArgumentException
* if the {@code mode} argument is invalid
* @throws SecurityException if access to the file is denied
* by the SecurityManager
* @since 1.3
*/
public JarFile(File file, boolean verify, int mode) throws IOException {
@ -337,8 +327,6 @@ public class JarFile extends ZipFile {
* @throws IOException if an I/O error has occurred
* @throws IllegalArgumentException
* if the {@code mode} argument is invalid
* @throws SecurityException if access to the file is denied
* by the SecurityManager
* @throws NullPointerException if {@code version} is {@code null}
* @since 9
*/

View file

@ -234,10 +234,6 @@ public abstract class LocaleServiceProvider {
/**
* Initializes a new locale service provider.
*
* @throws SecurityException
* If a security manager has been installed and it denies
* {@link RuntimePermission RuntimePermission("localeServiceProvider")}
*/
protected LocaleServiceProvider() {
this(checkPermission());

View file

@ -119,20 +119,12 @@ public class ZipFile implements ZipConstants, Closeable {
/**
* Opens a ZIP file for reading.
*
* <p>First, if there is a security manager, its {@code checkRead}
* method is called with the {@code name} argument as its argument
* to ensure the read is allowed.
*
* <p>The UTF-8 {@link java.nio.charset.Charset charset} is used to
* decode the entry names and comments.
*
* @param name the name of the ZIP file
* @throws ZipException if a ZIP format error has occurred
* @throws IOException if an I/O error has occurred
* @throws SecurityException if a security manager exists and its
* {@code checkRead} method doesn't allow read access to the file.
*
* @see SecurityManager#checkRead(java.lang.String)
*/
public ZipFile(String name) throws IOException {
this(new File(name), OPEN_READ);
@ -143,10 +135,6 @@ public class ZipFile implements ZipConstants, Closeable {
* {@code File} object in the specified mode. The mode argument
* must be either {@code OPEN_READ} or {@code OPEN_READ | OPEN_DELETE}.
*
* <p>First, if there is a security manager, its {@code checkRead}
* method is called with the {@code name} argument as its argument to
* ensure the read is allowed.
*
* <p>The UTF-8 {@link java.nio.charset.Charset charset} is used to
* decode the entry names and comments
*
@ -154,13 +142,7 @@ public class ZipFile implements ZipConstants, Closeable {
* @param mode the mode in which the file is to be opened
* @throws ZipException if a ZIP format error has occurred
* @throws IOException if an I/O error has occurred
* @throws SecurityException if a security manager exists and
* its {@code checkRead} method
* doesn't allow read access to the file,
* or its {@code checkDelete} method doesn't allow deleting
* the file when the {@code OPEN_DELETE} flag is set.
* @throws IllegalArgumentException if the {@code mode} argument is invalid
* @see SecurityManager#checkRead(java.lang.String)
* @since 1.3
*/
public ZipFile(File file, int mode) throws IOException {
@ -186,10 +168,6 @@ public class ZipFile implements ZipConstants, Closeable {
* {@code File} object in the specified mode. The mode argument
* must be either {@code OPEN_READ} or {@code OPEN_READ | OPEN_DELETE}.
*
* <p>First, if there is a security manager, its {@code checkRead}
* method is called with the {@code name} argument as its argument to
* ensure the read is allowed.
*
* @param file the ZIP file to be opened for reading
* @param mode the mode in which the file is to be opened
* @param charset
@ -201,16 +179,8 @@ public class ZipFile implements ZipConstants, Closeable {
* @throws ZipException if a ZIP format error has occurred
* @throws IOException if an I/O error has occurred
*
* @throws SecurityException
* if a security manager exists and its {@code checkRead}
* method doesn't allow read access to the file, or its
* {@code checkDelete} method doesn't allow deleting the
* file when the {@code OPEN_DELETE} flag is set
*
* @throws IllegalArgumentException if the {@code mode} argument is invalid
*
* @see SecurityManager#checkRead(java.lang.String)
*
* @since 1.7
*/
@SuppressWarnings("this-escape")
@ -246,10 +216,6 @@ public class ZipFile implements ZipConstants, Closeable {
/**
* Opens a ZIP file for reading.
*
* <p>First, if there is a security manager, its {@code checkRead}
* method is called with the {@code name} argument as its argument
* to ensure the read is allowed.
*
* @param name the name of the ZIP file
* @param charset
* the {@linkplain java.nio.charset.Charset charset} to
@ -259,11 +225,6 @@ public class ZipFile implements ZipConstants, Closeable {
*
* @throws ZipException if a ZIP format error has occurred
* @throws IOException if an I/O error has occurred
* @throws SecurityException
* if a security manager exists and its {@code checkRead}
* method doesn't allow read access to the file
*
* @see SecurityManager#checkRead(java.lang.String)
*
* @since 1.7
*/