8266459: Implement JEP 411: Deprecate the Security Manager for Removal

Co-authored-by: Sean Mullan <mullan@openjdk.org>
Co-authored-by: Lance Andersen <lancea@openjdk.org>
Co-authored-by: Weijun Wang <weijun@openjdk.org>
Reviewed-by: erikj, darcy, chegar, naoto, joehw, alanb, mchung, kcr, prr, lancea
This commit is contained in:
Weijun Wang 2021-06-02 11:57:31 +00:00
parent 19450b9951
commit 6765f90250
826 changed files with 2734 additions and 757 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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
@ -322,6 +322,7 @@ public class VerifyAccess {
// memoization. And the caller never gets to look at the alternate type binding
// ("res"), whether it exists or not.
final String name = type.getName();
@SuppressWarnings("removal")
Class<?> res = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<>() {
public Class<?> run() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2021, 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
@ -28,6 +28,7 @@ package sun.net;
import java.security.PrivilegedAction;
import java.security.Security;
@SuppressWarnings("removal")
public final class InetAddressCachePolicy {
// Controls the cache policy for successful lookups only

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2021, 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
@ -40,6 +40,7 @@ import java.util.Properties;
*
*/
@SuppressWarnings("removal")
public class NetProperties {
private static Properties props = new Properties();
static {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2021, 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
@ -39,6 +39,7 @@ import java.security.PrivilegedAction;
*
* @author Jonathan Payne
*/
@SuppressWarnings("removal")
public class NetworkClient {
/* Default value of read timeout, if not specified (infinity) */
public static final int DEFAULT_READ_TIMEOUT = -1;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2021, 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
@ -65,6 +65,7 @@ public class ResourceManager {
numSockets = new AtomicInteger();
}
@SuppressWarnings("removal")
public static void beforeUdpCreate() throws SocketException {
if (System.getSecurityManager() != null) {
if (numSockets.incrementAndGet() > maxSockets) {
@ -74,6 +75,7 @@ public class ResourceManager {
}
}
@SuppressWarnings("removal")
public static void afterUdpClose() {
if (System.getSecurityManager() != null) {
numSockets.decrementAndGet();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2021, 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
@ -55,6 +55,7 @@ public abstract class FtpClientProvider {
* {@link RuntimePermission}{@code ("ftpClientProvider")}
*/
protected FtpClientProvider() {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new RuntimePermission("ftpClientProvider"));
@ -134,6 +135,7 @@ public abstract class FtpClientProvider {
*
* @return The system-wide default FtpClientProvider
*/
@SuppressWarnings("removal")
public static FtpClientProvider provider() {
synchronized (lock) {
if (provider != null) {

View file

@ -48,6 +48,7 @@ import sun.net.ftp.*;
import sun.util.logging.PlatformLogger;
@SuppressWarnings("removal")
public class FtpClient extends sun.net.ftp.FtpClient {
private static int defaultSoTimeout;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, 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
@ -92,6 +92,7 @@ public class DefaultProxySelector extends ProxySelector {
static {
final String key = "java.net.useSystemProxies";
@SuppressWarnings("removal")
Boolean b = AccessController.doPrivileged(
new PrivilegedAction<Boolean>() {
public Boolean run() {
@ -103,6 +104,7 @@ public class DefaultProxySelector extends ProxySelector {
}
}
@SuppressWarnings("removal")
public static int socksProxyVersion() {
return AccessController.doPrivileged(
new PrivilegedAction<Integer>() {
@ -211,6 +213,7 @@ public class DefaultProxySelector extends ProxySelector {
* System properties it does help having only 1 call to doPrivileged.
* Be mindful what you do in here though!
*/
@SuppressWarnings("removal")
Proxy[] proxyArray = AccessController.doPrivileged(
new PrivilegedAction<Proxy[]>() {
public Proxy[] run() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2021, 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
@ -352,6 +352,7 @@ public class IPAddressUtil {
}
}
@SuppressWarnings("removal")
private static InetAddress findScopedAddress(InetAddress address) {
PrivilegedExceptionAction<List<InetAddress>> pa = () -> NetworkInterface.networkInterfaces()
.flatMap(NetworkInterface::inetAddresses)

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, 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
@ -93,6 +93,7 @@ public final class SocketExceptions {
// msg, or if the type doesn't support detail msgs, return given
// instance.
@SuppressWarnings("removal")
private static IOException create(IOException e, String msg) {
return AccessController.doPrivileged(new PrivilegedAction<IOException>() {
public IOException run() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2021, 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
@ -33,6 +33,7 @@ import java.util.Enumeration;
import java.util.Properties;
import java.util.StringTokenizer;
@SuppressWarnings("removal")
public class MimeTable implements FileNameMap {
/** Keyed by content type, returns MimeEntries */
private Hashtable<String, MimeEntry> entries

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2021, 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
@ -65,6 +65,7 @@ public class HttpCapture {
private static synchronized void init() {
initialized = true;
@SuppressWarnings("removal")
String rulesFile = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<>() {
public String run() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2021, 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
@ -353,6 +353,7 @@ public class HttpClient extends NetworkClient {
ret.authenticatorKey = httpuc.getAuthenticatorKey();
}
} else {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
if (ret.proxy == Proxy.NO_PROXY || ret.proxy == null) {
@ -544,6 +545,7 @@ public class HttpClient extends NetworkClient {
/*
* call openServer in a privileged block
*/
@SuppressWarnings("removal")
private void privilegedOpenServer(final InetSocketAddress server)
throws IOException
{
@ -575,6 +577,7 @@ public class HttpClient extends NetworkClient {
*/
protected void openServer() throws IOException {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
lock();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2021, 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
@ -62,6 +62,7 @@ public class KeepAliveCache
*/
static final int MAX_CONNECTIONS = 5;
static int result = -1;
@SuppressWarnings("removal")
static int getMaxConnections() {
if (result == -1) {
result = AccessController.doPrivileged(
@ -90,6 +91,7 @@ public class KeepAliveCache
* @param url The URL contains info about the host and port
* @param http The HttpClient to be cached
*/
@SuppressWarnings("removal")
public void put(final URL url, Object obj, HttpClient http) {
cacheLock.lock();
try {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2021, 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
@ -158,6 +158,7 @@ class KeepAliveStream extends MeteredStream implements Hurryable {
}
}
@SuppressWarnings("removal")
private static void queueForCleanup(KeepAliveCleanerEntry kace) {
queue.lock();
try {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, 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
@ -64,6 +64,7 @@ class KeepAliveStreamCleaner
static {
final String maxDataKey = "http.KeepAlive.remainingData";
@SuppressWarnings("removal")
int maxData = AccessController.doPrivileged(
new PrivilegedAction<Integer>() {
public Integer run() {
@ -72,6 +73,7 @@ class KeepAliveStreamCleaner
MAX_DATA_REMAINING = maxData;
final String maxCapacityKey = "http.KeepAlive.queuedConnections";
@SuppressWarnings("removal")
int maxCapacity = AccessController.doPrivileged(
new PrivilegedAction<Integer>() {
public Integer run() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2021, 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
@ -235,6 +235,7 @@ public class FtpURLConnection extends URLConnection {
/**
* Do we have to use a proxy?
*/
@SuppressWarnings("removal")
ProxySelector sel = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<ProxySelector>() {
public ProxySelector run() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2021, 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
@ -53,6 +53,7 @@ import sun.net.www.HeaderParser;
// policy in HttpURLConnection. A failure on baz.foo.com shouldn't
// uncache foo.com!
@SuppressWarnings("removal")
public abstract class AuthenticationInfo extends AuthCacheValue implements Cloneable {
@java.io.Serial

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, 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
@ -64,6 +64,7 @@ class DigestAuthentication extends AuthenticationInfo {
private static final boolean delimCompatFlag;
static {
@SuppressWarnings("removal")
Boolean b = AccessController.doPrivileged(
new PrivilegedAction<>() {
public Boolean run() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2021, 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
@ -219,6 +219,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
"Via"
};
@SuppressWarnings("removal")
private static String getNetProperty(String name) {
PrivilegedAction<String> pa = () -> NetProperties.get(name);
return AccessController.doPrivileged(pa);
@ -454,6 +455,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
* privileged request password authentication
*
*/
@SuppressWarnings("removal")
private static PasswordAuthentication
privilegedRequestPasswordAuthentication(
final Authenticator authenticator,
@ -766,6 +768,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
}
private boolean checkSetHost() {
@SuppressWarnings("removal")
SecurityManager s = System.getSecurityManager();
if (s != null) {
String name = s.getClass().getName();
@ -786,6 +789,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
}
private void checkURLFile() {
@SuppressWarnings("removal")
SecurityManager s = System.getSecurityManager();
if (s != null) {
String name = s.getClass().getName();
@ -909,6 +913,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
return u;
}
@SuppressWarnings("removal")
protected HttpURLConnection(URL u, Proxy p, Handler handler)
throws IOException {
super(checkURL(u));
@ -1008,6 +1013,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
//
// Same as java.net.URL.hostsEqual
//
@SuppressWarnings("removal")
private static boolean hostsEqual(URL u1, URL u2) {
final String h1 = u1.getHost();
final String h2 = u2.getHost();
@ -1066,6 +1072,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
return false;
}
@SuppressWarnings("removal")
private String getHostAndPort(URL url) {
String host = url.getHost();
final String hostarg = host;
@ -1092,6 +1099,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
return host + ":" + Integer.toString(port);
}
@SuppressWarnings("removal")
protected void plainConnect() throws IOException {
lock();
try {
@ -1133,6 +1141,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
return socketPermission;
}
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm == null) {
@ -1205,6 +1214,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
/**
* Do we have to use a proxy?
*/
@SuppressWarnings("removal")
ProxySelector sel =
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<>() {
@ -1367,6 +1377,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
* - get input, [read input,] get output, [write output]
*/
@SuppressWarnings("removal")
@Override
public OutputStream getOutputStream() throws IOException {
lock();
@ -1554,6 +1565,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
} // end of getting cookies
}
@SuppressWarnings("removal")
@Override
public InputStream getInputStream() throws IOException {
lock();
@ -2025,6 +2037,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
private IOException getChainedException(final IOException rememberedException) {
try {
final Object[] args = { rememberedException.getMessage() };
@SuppressWarnings("removal")
IOException chainedException =
java.security.AccessController.doPrivileged(
new java.security.PrivilegedExceptionAction<>() {
@ -2340,7 +2353,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
* Gets the authentication for an HTTP proxy, and applies it to
* the connection.
*/
@SuppressWarnings("fallthrough")
@SuppressWarnings({"removal","fallthrough"})
private AuthenticationInfo getHttpProxyAuthentication(AuthenticationHeader authhdr) {
assert isLockHeldByCurrentThread();
@ -2731,6 +2744,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
* resets the url, re-connects, and resets the request
* property.
*/
@SuppressWarnings("removal")
private boolean followRedirect() throws IOException {
if (!getInstanceFollowRedirects()) {
return false;
@ -2815,6 +2829,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
String proxyHost = locUrl.getHost();
int proxyPort = locUrl.getPort();
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkConnect(proxyHost, proxyPort);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2021, 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
@ -382,6 +382,7 @@ final class HttpsClient extends HttpClient
ret.authenticatorKey = httpuc.getAuthenticatorKey();
}
} else {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
if (ret.proxy == Proxy.NO_PROXY || ret.proxy == null) {

View file

@ -189,6 +189,7 @@ public class URLJarFile extends JarFile {
* Given a URL, retrieves a JAR file, caches it to disk, and creates a
* cached JAR file object.
*/
@SuppressWarnings("removal")
private static JarFile retrieve(final URL url, final URLJarFileCloseController closeController) throws IOException {
/*
* See if interface is set, then call retrieve function of the class

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, 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
@ -47,6 +47,7 @@ import sun.net.www.URLConnection;
* URLConnection implementation that can be used to connect to resources
* contained in the runtime image.
*/
@SuppressWarnings("removal")
public class JavaRuntimeURLConnection extends URLConnection {
// ImageReader to access resources in jimage

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2021, 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
@ -68,6 +68,7 @@ public class MailToURLConnection extends URLConnection {
String str = System.getProperty("user.fromaddr");
if (str == null) {
// Perform the property security check for user.name
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPropertyAccess("user.name");

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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,6 +48,7 @@ abstract class AsynchronousChannelGroupImpl
{
// number of internal threads handling I/O events when using an unbounded
// thread pool. Internal threads do not dispatch to completion handlers.
@SuppressWarnings("removal")
private static final int internalThreadCount = AccessController.doPrivileged(
new GetIntegerAction("sun.nio.ch.internalThreadPoolSize", 1));
@ -114,6 +115,7 @@ abstract class AsynchronousChannelGroupImpl
};
}
@SuppressWarnings("removal")
private void startInternalThread(final Runnable task) {
AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
@ -245,6 +247,7 @@ abstract class AsynchronousChannelGroupImpl
*/
abstract void shutdownHandlerTasks();
@SuppressWarnings("removal")
private void shutdownExecutors() {
AccessController.doPrivileged(
new PrivilegedAction<>() {
@ -317,13 +320,16 @@ abstract class AsynchronousChannelGroupImpl
*/
@Override
public final void execute(Runnable task) {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
// when a security manager is installed then the user's task
// must be run with the current calling context
@SuppressWarnings("removal")
final AccessControlContext acc = AccessController.getContext();
final Runnable delegate = task;
task = new Runnable() {
@SuppressWarnings("removal")
@Override
public void run() {
AccessController.doPrivileged(new PrivilegedAction<>() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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
@ -150,6 +150,7 @@ abstract class AsynchronousServerSocketChannelImpl
{
InetSocketAddress isa = (local == null) ? new InetSocketAddress(0) :
Net.checkAddress(local);
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkListen(isa.getPort());

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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
@ -429,6 +429,7 @@ abstract class AsynchronousSocketChannelImpl
throw new AlreadyBoundException();
InetSocketAddress isa = (local == null) ?
new InetSocketAddress(0) : Net.checkAddress(local);
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkListen(isa.getPort());

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2021, 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
@ -536,6 +536,7 @@ class DatagramChannelImpl
try {
SocketAddress remote = beginRead(blocking, false);
boolean connected = (remote != null);
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (connected || (sm == null)) {
// connected or no security manager
@ -571,6 +572,7 @@ class DatagramChannelImpl
* manager.
*/
private SocketAddress untrustedReceive(ByteBuffer dst) throws IOException {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
assert readLock.isHeldByCurrentThread()
&& sm != null && remoteAddress == null;
@ -622,6 +624,7 @@ class DatagramChannelImpl
ensureOpen();
if (!isBlocking())
throw new IllegalBlockingModeException();
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
boolean connected = isConnected();
SocketAddress sender;
@ -801,6 +804,7 @@ class DatagramChannelImpl
completed = (n > 0);
} else {
// not connected
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
InetAddress ia = isa.getAddress();
if (sm != null) {
@ -1182,6 +1186,7 @@ class DatagramChannelImpl
} else {
isa = Net.checkAddress(local, family);
}
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkListen(isa.getPort());
@ -1210,6 +1215,7 @@ class DatagramChannelImpl
*/
DatagramChannel connect(SocketAddress sa, boolean check) throws IOException {
InetSocketAddress isa = Net.checkAddress(sa, family);
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
InetAddress ia = isa.getAddress();
@ -1425,6 +1431,7 @@ class DatagramChannelImpl
/**
* Defines static methods to access AbstractSelectableChannel non-public members.
*/
@SuppressWarnings("removal")
private static class AbstractSelectableChannels {
private static final Method FOREACH;
static {
@ -1481,6 +1488,7 @@ class DatagramChannelImpl
throw new IllegalArgumentException("Source address is different type to group");
}
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkMulticast(group);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2021, 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
@ -174,6 +174,7 @@ public class DatagramSocketAdaptor
if (addr.isAnyLocalAddress())
return local;
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
try {
@ -264,6 +265,7 @@ public class DatagramSocketAdaptor
if (local == null)
local = new InetSocketAddress(0);
InetAddress result = local.getAddress();
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
try {
@ -524,6 +526,7 @@ public class DatagramSocketAdaptor
MembershipKey key = dc.findMembership(group, ni);
if (key != null) {
// already a member but need to check permission anyway
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkMulticast(group);
@ -539,6 +542,7 @@ public class DatagramSocketAdaptor
NetworkInterface ni = (netIf != null) ? netIf : defaultNetworkInterface();
if (isClosed())
throw new SocketException("Socket is closed");
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkMulticast(group);
@ -580,6 +584,7 @@ public class DatagramSocketAdaptor
// network interface has changed so update cached values
PrivilegedAction<InetAddress> pa;
pa = () -> ni.inetAddresses().findFirst().orElse(null);
@SuppressWarnings("removal")
InetAddress ia = AccessController.doPrivileged(pa);
if (ia == null)
throw new SocketException("Network interface has no IP address");
@ -699,6 +704,7 @@ public class DatagramSocketAdaptor
try {
PrivilegedExceptionAction<Lookup> pa = () ->
MethodHandles.privateLookupIn(DatagramPacket.class, MethodHandles.lookup());
@SuppressWarnings("removal")
MethodHandles.Lookup l = AccessController.doPrivileged(pa);
LENGTH = l.findVarHandle(DatagramPacket.class, "length", int.class);
BUF_LENGTH = l.findVarHandle(DatagramPacket.class, "bufLength", int.class);
@ -737,6 +743,7 @@ public class DatagramSocketAdaptor
try {
PrivilegedExceptionAction<Lookup> pa = () ->
MethodHandles.privateLookupIn(NetworkInterface.class, MethodHandles.lookup());
@SuppressWarnings("removal")
MethodHandles.Lookup l = AccessController.doPrivileged(pa);
MethodType methodType = MethodType.methodType(NetworkInterface.class);
GET_DEFAULT = l.findStatic(NetworkInterface.class, "getDefault", methodType);
@ -780,6 +787,7 @@ public class DatagramSocketAdaptor
try {
PrivilegedExceptionAction<Lookup> pa = () ->
MethodHandles.privateLookupIn(DatagramSocket.class, MethodHandles.lookup());
@SuppressWarnings("removal")
MethodHandles.Lookup l = AccessController.doPrivileged(pa);
NO_DELEGATE = (SocketAddress)
l.findStaticVarHandle(DatagramSocket.class, "NO_DELEGATE",

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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
@ -41,6 +41,7 @@ class Invoker {
// maximum number of completion handlers that may be invoked on the current
// thread before it re-directs invocations to the thread pool. This helps
// avoid stack overflow and lessens the risk of starvation.
@SuppressWarnings("removal")
private static final int maxHandlerInvokeCount = AccessController.doPrivileged(
new GetIntegerAction("sun.nio.ch.maxCompletionHandlersOnStack", 16));
@ -118,6 +119,7 @@ class Invoker {
* Invoke handler without checking the thread identity or number of handlers
* on the thread stack.
*/
@SuppressWarnings("removal")
static <V,A> void invokeUnchecked(CompletionHandler<V,? super A> handler,
A attachment,
V value,

View file

@ -228,6 +228,7 @@ public class Net {
*/
static InetSocketAddress getRevealedLocalAddress(SocketAddress sa) {
InetSocketAddress isa = (InetSocketAddress) sa;
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (isa != null && sm != null) {
try {
@ -240,6 +241,7 @@ public class Net {
return isa;
}
@SuppressWarnings("removal")
static String getRevealedLocalAddressAsString(SocketAddress sa) {
InetSocketAddress isa = (InetSocketAddress) sa;
if (System.getSecurityManager() == null) {
@ -308,6 +310,7 @@ public class Net {
* Returns any IPv4 address of the given network interface, or
* null if the interface does not have any IPv4 addresses.
*/
@SuppressWarnings("removal")
static Inet4Address anyInet4Address(final NetworkInterface interf) {
return AccessController.doPrivileged(new PrivilegedAction<Inet4Address>() {
public Inet4Address run() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, 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
@ -43,6 +43,7 @@ class Reflect { // package-private
}
}
@SuppressWarnings("removal")
private static void setAccessible(final AccessibleObject ao) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, 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
@ -61,6 +61,7 @@ class ServerSocketAdaptor // package-private
// Timeout "option" value for accepts
private volatile int timeout;
@SuppressWarnings("removal")
static ServerSocket create(ServerSocketChannelImpl ssc) {
PrivilegedExceptionAction<ServerSocket> pa = () -> new ServerSocketAdaptor(ssc);
try {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, 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
@ -329,6 +329,7 @@ class ServerSocketChannelImpl
} else {
isa = Net.checkAddress(local, family);
}
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkListen(isa.getPort());
@ -488,6 +489,7 @@ class ServerSocketChannelImpl
// check permitted to accept connections from the remote address
if (isNetSocket()) {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
InetSocketAddress isa = (InetSocketAddress) sa;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, 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
@ -63,6 +63,7 @@ class SocketAdaptor
this.sc = sc;
}
@SuppressWarnings("removal")
static Socket create(SocketChannelImpl sc) {
PrivilegedExceptionAction<Socket> pa = () -> new SocketAdaptor(sc);
try {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, 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
@ -720,6 +720,7 @@ class SocketChannelImpl
} else {
isa = Net.checkAddress(local, family);
}
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkListen(isa.getPort());
@ -813,6 +814,7 @@ class SocketChannelImpl
return UnixDomainSockets.checkAddress(sa);
} else {
InetSocketAddress isa = Net.checkAddress(sa, family);
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkConnect(isa.getAddress().getHostAddress(), isa.getPort());

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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
@ -72,6 +72,7 @@ public class ThreadPool {
return poolSize;
}
@SuppressWarnings("removal")
static ThreadFactory defaultThreadFactory() {
if (System.getSecurityManager() == null) {
return (Runnable r) -> {
@ -147,6 +148,7 @@ public class ThreadPool {
}
private static int getDefaultThreadPoolInitialSize() {
@SuppressWarnings("removal")
String propValue = AccessController.doPrivileged(new
GetPropertyAction(DEFAULT_THREAD_POOL_INITIAL_SIZE));
if (propValue != null) {
@ -161,6 +163,7 @@ public class ThreadPool {
}
private static ThreadFactory getDefaultThreadPoolThreadFactory() {
@SuppressWarnings("removal")
String propValue = AccessController.doPrivileged(new
GetPropertyAction(DEFAULT_THREAD_POOL_THREAD_FACTORY));
if (propValue != null) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, 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
@ -58,6 +58,7 @@ class UnixDomainSockets {
}
static void checkPermission() {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(accessUnixDomainSocket);
@ -82,6 +83,7 @@ class UnixDomainSockets {
private static native byte[] localAddress0(FileDescriptor fd) throws IOException;
@SuppressWarnings("removal")
static String getRevealedLocalAddressAsString(SocketAddress sa) {
return (System.getSecurityManager() != null) ? sa.toString() : "";
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, 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
@ -407,6 +407,7 @@ public class Util {
private static volatile Constructor<?> directByteBufferConstructor;
@SuppressWarnings("removal")
private static void initDBBConstructor() {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
@ -455,6 +456,7 @@ public class Util {
private static volatile Constructor<?> directByteBufferRConstructor;
@SuppressWarnings("removal")
private static void initDBBRConstructor() {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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
@ -134,6 +134,7 @@ public class CharsetMapping {
}
// init the CharsetMapping object from the .dat binary file
@SuppressWarnings("removal")
public static CharsetMapping get(final InputStream is) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
public CharsetMapping run() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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
@ -54,6 +54,7 @@ abstract class AbstractPoller implements Runnable {
/**
* Starts the poller thread
*/
@SuppressWarnings("removal")
public void start() {
final Runnable thisRunnable = this;
AccessController.doPrivileged(new PrivilegedAction<>() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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
@ -44,6 +44,7 @@ abstract class AbstractUserDefinedFileAttributeView
boolean checkWrite)
{
assert checkRead || checkWrite;
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
if (checkRead)

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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
@ -82,6 +82,7 @@ class PollingWatchService
/**
* Register the given file with this watch service
*/
@SuppressWarnings("removal")
@Override
WatchKey register(final Path path,
WatchEvent.Kind<?>[] events,
@ -194,6 +195,7 @@ class PollingWatchService
}
@SuppressWarnings("removal")
@Override
void implClose() throws IOException {
synchronized (map) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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
@ -36,6 +36,7 @@ import java.security.PrivilegedAction;
class Reflect {
private Reflect() {}
@SuppressWarnings("removal")
private static void setAccessible(final AccessibleObject ao) {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override

View file

@ -467,6 +467,7 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
return value;
}
@SuppressWarnings("removal")
private Method[] computeMemberMethods() {
return AccessController.doPrivileged(
new PrivilegedAction<Method[]>() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, 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
@ -293,6 +293,7 @@ public class AnnotationParser {
* Returns an annotation of the given type backed by the given
* member {@literal ->} value map.
*/
@SuppressWarnings("removal")
public static Annotation annotationForMap(final Class<? extends Annotation> type,
final Map<String, Object> memberValues)
{

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, 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
@ -181,6 +181,7 @@ public final class AnnotationSupport {
/* Reflectively invoke the values-method of the given annotation
* (container), cast it to an array of annotations and return the result.
*/
@SuppressWarnings("removal")
private static <A extends Annotation> A[] getValueArray(Annotation container) {
try {
// According to JLS the container must have an array-valued value

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, 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
@ -105,6 +105,7 @@ public class AnnotationType {
if (!annotationClass.isAnnotation())
throw new IllegalArgumentException("Not an annotation type");
@SuppressWarnings("removal")
Method[] methods =
AccessController.doPrivileged(new PrivilegedAction<>() {
public Method[] run() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, 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
@ -53,6 +53,7 @@ class Trampoline {
}
}
@SuppressWarnings("removal")
private static void ensureInvocableMethod(Method m)
throws InvocationTargetException
{
@ -101,6 +102,7 @@ public final class MethodUtil extends SecureClassLoader {
* Class.getMethods() and walking towards Object until
* we're done.
*/
@SuppressWarnings("removal")
public static Method[] getPublicMethods(Class<?> cls) {
// compatibility for update release
if (System.getSecurityManager() == null) {
@ -278,6 +280,7 @@ public final class MethodUtil extends SecureClassLoader {
}
}
@SuppressWarnings("removal")
private static Method getTrampoline() {
try {
return AccessController.doPrivileged(

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, 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
@ -82,6 +82,7 @@ public final class ReflectUtil {
* @param m the {@code Member} about to be accessed
*/
public static void conservativeCheckMemberAccess(Member m) throws SecurityException{
@SuppressWarnings("removal")
final SecurityManager sm = System.getSecurityManager();
if (sm == null)
return;
@ -114,6 +115,7 @@ public final class ReflectUtil {
* also check the package access on the proxy interfaces.
*/
public static void checkPackageAccess(Class<?> clazz) {
@SuppressWarnings("removal")
SecurityManager s = System.getSecurityManager();
if (s != null) {
privateCheckPackageAccess(s, clazz);
@ -123,7 +125,7 @@ public final class ReflectUtil {
/**
* NOTE: should only be called if a SecurityManager is installed
*/
private static void privateCheckPackageAccess(SecurityManager s, Class<?> clazz) {
private static void privateCheckPackageAccess(@SuppressWarnings("removal") SecurityManager s, Class<?> clazz) {
String pkg = clazz.getPackageName();
if (!pkg.isEmpty()) {
s.checkPackageAccess(pkg);
@ -141,6 +143,7 @@ public final class ReflectUtil {
* the true caller (application).
*/
public static void checkPackageAccess(String name) {
@SuppressWarnings("removal")
SecurityManager s = System.getSecurityManager();
if (s != null) {
String cname = name.replace('/', '.');
@ -207,6 +210,7 @@ public final class ReflectUtil {
* @param clazz Proxy class object
*/
public static void checkProxyPackageAccess(Class<?> clazz) {
@SuppressWarnings("removal")
SecurityManager s = System.getSecurityManager();
if (s != null) {
privateCheckProxyPackageAccess(s, clazz);
@ -216,7 +220,7 @@ public final class ReflectUtil {
/**
* NOTE: should only be called if a SecurityManager is installed
*/
private static void privateCheckProxyPackageAccess(SecurityManager s, Class<?> clazz) {
private static void privateCheckProxyPackageAccess(@SuppressWarnings("removal") SecurityManager s, Class<?> clazz) {
// check proxy interfaces if the given class is a proxy class
if (Proxy.isProxyClass(clazz)) {
for (Class<?> intf : clazz.getInterfaces()) {
@ -235,6 +239,7 @@ public final class ReflectUtil {
public static void checkProxyPackageAccess(ClassLoader ccl,
Class<?>... interfaces)
{
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
for (Class<?> intf : interfaces) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2021, 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
@ -84,6 +84,7 @@ public class GetBooleanAction
*
* @param theProp the name of the system property.
*/
@SuppressWarnings("removal")
public static boolean privilegedGetProperty(String theProp) {
if (System.getSecurityManager() == null) {
return Boolean.getBoolean(theProp);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2021, 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
@ -125,6 +125,7 @@ public class GetIntegerAction
*
* @param theProp the name of the system property.
*/
@SuppressWarnings("removal")
public static Integer privilegedGetProperty(String theProp) {
if (System.getSecurityManager() == null) {
return Integer.getInteger(theProp);
@ -147,6 +148,7 @@ public class GetIntegerAction
* @param theProp the name of the system property.
* @param defaultVal the default value.
*/
@SuppressWarnings("removal")
public static Integer privilegedGetProperty(String theProp,
int defaultVal) {
Integer value;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2021, 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
@ -100,6 +100,7 @@ public class GetPropertyAction implements PrivilegedAction<String> {
*
* @param theProp the name of the system property.
*/
@SuppressWarnings("removal")
public static String privilegedGetProperty(String theProp) {
if (System.getSecurityManager() == null) {
return System.getProperty(theProp);
@ -122,6 +123,7 @@ public class GetPropertyAction implements PrivilegedAction<String> {
* @param theProp the name of the system property.
* @param defaultVal the default value.
*/
@SuppressWarnings("removal")
public static String privilegedGetProperty(String theProp,
String defaultVal) {
if (System.getSecurityManager() == null) {
@ -143,6 +145,7 @@ public class GetPropertyAction implements PrivilegedAction<String> {
* are not made accessible to untrusted code since it may contain
* sensitive information.
*/
@SuppressWarnings("removal")
public static Properties privilegedGetProperties() {
if (System.getSecurityManager() == null) {
return System.getProperties();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, 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
@ -94,6 +94,7 @@ final class ProviderConfig {
// avoid if not available (pre Solaris 10) to reduce startup time
// or if disabled via system property
private void checkSunPKCS11Solaris() {
@SuppressWarnings("removal")
Boolean o = AccessController.doPrivileged(
new PrivilegedAction<Boolean>() {
public Boolean run() {
@ -159,7 +160,7 @@ final class ProviderConfig {
/**
* Get the provider object. Loads the provider if it is not already loaded.
*/
@SuppressWarnings("deprecation")
@SuppressWarnings({"removal","deprecation"})
Provider getProvider() {
// volatile variable load
Provider p = provider;
@ -240,6 +241,7 @@ final class ProviderConfig {
* @throws ProviderException if executing the Provider's constructor
* throws a ProviderException. All other Exceptions are ignored.
*/
@SuppressWarnings("removal")
private Provider doLoadProvider() {
return AccessController.doPrivileged(new PrivilegedAction<Provider>() {
public Provider run() {
@ -294,6 +296,7 @@ final class ProviderConfig {
*
* NOTE use of doPrivileged().
*/
@SuppressWarnings("removal")
private static String expand(final String value) {
// shortcut if value does not contain any properties
if (value.contains("${") == false) {
@ -394,6 +397,7 @@ final class ProviderConfig {
return null;
}
@SuppressWarnings("removal")
Provider p = AccessController.doPrivileged
(new PrivilegedExceptionAction<Provider>() {
@SuppressWarnings("deprecation") // Class.newInstance

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, 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
@ -87,6 +87,7 @@ public final class ProviderList {
// construct a ProviderList from the security properties
// (static provider configuration in the java.security file)
@SuppressWarnings("removal")
static ProviderList fromSecurityProperties() {
// doPrivileged() because of Security.getProperty()
return AccessController.doPrivileged(

View file

@ -2736,6 +2736,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
if (useLegacy()) {
return LEGACY_KEY_PBE_ALGORITHM;
}
@SuppressWarnings("removal")
String result = AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
String result;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, 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
@ -159,6 +159,7 @@ public final class ConfigFile extends Configuration {
}
}
@SuppressWarnings("removal")
public Spi(final Configuration.Parameters params) throws IOException {
// call in a doPrivileged
@ -380,6 +381,7 @@ public final class ConfigFile extends Configuration {
* @throws SecurityException if the caller does not have permission
* to refresh the Configuration.
*/
@SuppressWarnings("removal")
@Override
public synchronized void engineRefresh() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, 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
@ -93,6 +93,7 @@ public final class DRBG extends SecureRandomSpi {
// Can be configured with a security property
@SuppressWarnings("removal")
String config = AccessController.doPrivileged((PrivilegedAction<String>)
() -> Security.getProperty(PROP_NAME));

View file

@ -43,6 +43,7 @@ import static sun.security.util.SecurityConstants.PROVIDER_VER;
*
* @author Andreas Sterbenz
*/
@SuppressWarnings("removal")
public final class MD4 extends DigestBase {
// state of this object

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, 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
@ -238,6 +238,7 @@ import static jdk.internal.access.JavaSecurityAccess.ProtectionDomainCache;
* @see java.security.Permissions
* @see java.security.ProtectionDomain
*/
@SuppressWarnings("removal")
public class PolicyFile extends java.security.Policy {
private static final Debug debug = Debug.getInstance("policy");

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, 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
@ -41,6 +41,7 @@ import java.net.MalformedURLException;
* via the Policy.getInstance calls.
*
*/
@SuppressWarnings("removal")
public final class PolicySpiFile extends PolicySpi {
private PolicyFile pf;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2021, 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
@ -149,6 +149,7 @@ abstract class SeedGenerator {
/**
* Retrieve some system information, hashed.
*/
@SuppressWarnings("removal")
static byte[] getSystemEntropy() {
final MessageDigest md;
@ -293,6 +294,7 @@ abstract class SeedGenerator {
}
final ThreadGroup[] finalsg = new ThreadGroup[1];
@SuppressWarnings("removal")
Thread t = java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction<>() {
@Override
@ -500,6 +502,7 @@ abstract class SeedGenerator {
init();
}
@SuppressWarnings("removal")
private void init() throws IOException {
final URL device = new URL(deviceName);
try {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, 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
@ -80,6 +80,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
* @param certs the signers associated with this
* <code>SubjectCodeSource</code> <p>
*/
@SuppressWarnings("removal")
SubjectCodeSource(Subject subject,
LinkedList<PrincipalEntry> principals,
URL url, Certificate[] certs) {
@ -365,6 +366,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
*
* @return a String representation of this <code>SubjectCodeSource</code>.
*/
@SuppressWarnings("removal")
public String toString() {
String returnMe = super.toString();
if (getSubject() != null) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2021, 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
@ -47,6 +47,7 @@ public final class Sun extends Provider {
"PKIX CertPathBuilder; LDAP, Collection CertStores, JavaPolicy Policy; " +
"JavaLoginConfig Configuration)";
@SuppressWarnings("removal")
public Sun() {
/* We are the SUN provider */
super("SUN", PROVIDER_VER, INFO);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2021, 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
@ -81,6 +81,7 @@ import static sun.security.util.SecurityProviderConstants.getAliases;
* - JavaLoginConfig is the default file-based LoginModule Configuration type.
*/
@SuppressWarnings("removal")
public final class SunEntries {
// the default algo used by SecureRandom class for new SecureRandom() calls

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2021, 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
@ -61,6 +61,7 @@ public final class VerificationProvider extends Provider {
ACTIVE = b;
}
@SuppressWarnings("removal")
public VerificationProvider() {
super("SunJarVerification", PROVIDER_VER, "Jar Verification Provider");
// register all algorithms normally registered by the Sun and SunRsaSign

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2021, 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
@ -85,6 +85,7 @@ public final class OCSP {
* value is negative, set the timeout length to the default.
*/
private static int initializeTimeout() {
@SuppressWarnings("removal")
Integer tmp = java.security.AccessController.doPrivileged(
new GetIntegerAction("com.sun.security.ocsp.timeout"));
if (tmp == null || tmp < 0) {

View file

@ -160,6 +160,7 @@ public final class OCSPResponse {
* value is negative, set the skew to the default.
*/
private static int initializeClockSkew() {
@SuppressWarnings("removal")
Integer tmp = java.security.AccessController.doPrivileged(
new GetIntegerAction("com.sun.security.ocsp.clockSkew"));
if (tmp == null || tmp < 0) {

View file

@ -180,6 +180,7 @@ class RevocationChecker extends PKIXRevocationChecker {
}
}
@SuppressWarnings("removal")
private static RevocationProperties getRevocationProperties() {
return AccessController.doPrivileged(
new PrivilegedAction<RevocationProperties>() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, 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
@ -43,6 +43,7 @@ public final class SunRsaSign extends Provider {
@java.io.Serial
private static final long serialVersionUID = 866040293550393045L;
@SuppressWarnings("removal")
public SunRsaSign() {
super("SunRsaSign", PROVIDER_VER, "Sun RSA signature provider");

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, 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
@ -66,6 +66,7 @@ final class AlpnExtension {
static final Charset alpnCharset;
static {
@SuppressWarnings("removal")
String alpnCharsetString = AccessController.doPrivileged(
(PrivilegedAction<String>) ()
-> Security.getProperty("jdk.tls.alpnCharset"));

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, 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
@ -229,6 +229,7 @@ final class PredefinedDHParameterSpecs {
static final Map<Integer, DHParameterSpec> ffdheParams;
static {
@SuppressWarnings("removal")
String property = AccessController.doPrivileged(
new PrivilegedAction<String>() {
public String run() {

View file

@ -415,6 +415,7 @@ enum SSLCipher {
static {
final long max = 4611686018427387904L; // 2^62
@SuppressWarnings("removal")
String prop = AccessController.doPrivileged(
new PrivilegedAction<String>() {
@Override

View file

@ -79,6 +79,7 @@ final class SSLConfiguration implements Cloneable {
BiFunction<SSLSocket, List<String>, String> socketAPSelector;
BiFunction<SSLEngine, List<String>, String> engineAPSelector;
@SuppressWarnings("removal")
HashMap<HandshakeCompletedListener, AccessControlContext>
handshakeListeners;
@ -266,6 +267,7 @@ final class SSLConfiguration implements Cloneable {
}
// SSLSocket only
@SuppressWarnings("removal")
void addHandshakeCompletedListener(
HandshakeCompletedListener listener) {
@ -408,7 +410,7 @@ final class SSLConfiguration implements Cloneable {
}
@Override
@SuppressWarnings({"unchecked", "CloneDeclaresCloneNotSupported"})
@SuppressWarnings({"removal","unchecked", "CloneDeclaresCloneNotSupported"})
public Object clone() {
// Note that only references to the configurations are copied.
try {

View file

@ -966,6 +966,7 @@ public abstract class SSLContextImpl extends SSLContextSpi {
return tmf.getTrustManagers();
}
@SuppressWarnings("removal")
private static KeyManager[] getKeyManagers() throws Exception {
final Map<String,String> props = new HashMap<>();

View file

@ -1195,6 +1195,7 @@ final class SSLEngineImpl extends SSLEngine implements SSLTransport {
this.engine = engineInstance;
}
@SuppressWarnings("removal")
@Override
public void run() {
engine.engineLock.lock();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2021, 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
@ -903,6 +903,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* are currently valid in this process. For client sessions,
* this returns null.
*/
@SuppressWarnings("removal")
@Override
public SSLSessionContext getSessionContext() {
/*
@ -1532,6 +1533,7 @@ class SecureKey {
private final Object securityCtx;
static Object getCurrentSecurityContext() {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
Object context = null;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, 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
@ -60,6 +60,7 @@ class ServerHandshakeContext extends HandshakeContext {
ServerHandshakeContext(SSLContextImpl sslContext,
TransportContext conContext) throws IOException {
super(sslContext, conContext);
@SuppressWarnings("removal")
long respTimeOut = AccessController.doPrivileged(
new GetLongAction("jdk.tls.stapling.responseTimeout",
DEFAULT_STATUS_RESP_DELAY));

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, 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
@ -75,11 +75,13 @@ final class StatusResponseManager {
* Create a StatusResponseManager with default parameters.
*/
StatusResponseManager() {
@SuppressWarnings("removal")
int cap = AccessController.doPrivileged(
new GetIntegerAction("jdk.tls.stapling.cacheSize",
DEFAULT_CACHE_SIZE));
cacheCapacity = cap > 0 ? cap : 0;
@SuppressWarnings("removal")
int life = AccessController.doPrivileged(
new GetIntegerAction("jdk.tls.stapling.cacheLifetime",
DEFAULT_CACHE_LIFETIME));

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, 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
@ -65,6 +65,7 @@ public class SunJSSE extends java.security.Provider {
registerAlgorithms();
}
@SuppressWarnings("removal")
private void registerAlgorithms() {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
doRegister();

View file

@ -48,6 +48,7 @@ final class TransportContext implements ConnectionContext {
// registered plaintext consumers
final Map<Byte, SSLConsumer> consumers;
@SuppressWarnings("removal")
final AccessControlContext acc;
final SSLContextImpl sslContext;
@ -133,6 +134,7 @@ final class TransportContext implements ConnectionContext {
inputRecord, outputRecord, false);
}
@SuppressWarnings("removal")
private TransportContext(SSLContextImpl sslContext, SSLTransport transport,
SSLConfiguration sslConfig, InputRecord inputRecord,
OutputRecord outputRecord, boolean isUnsureMode) {
@ -660,17 +662,20 @@ final class TransportContext implements ConnectionContext {
// A separate thread is allocated to deliver handshake completion
// events.
private static class NotifyHandshake implements Runnable {
@SuppressWarnings("removal")
private final Set<Map.Entry<HandshakeCompletedListener,
AccessControlContext>> targets; // who gets notified
private final HandshakeCompletedEvent event; // the notification
NotifyHandshake(
@SuppressWarnings("removal")
Map<HandshakeCompletedListener,AccessControlContext> listeners,
HandshakeCompletedEvent event) {
this.targets = new HashSet<>(listeners.entrySet()); // clone
this.event = event;
}
@SuppressWarnings("removal")
@Override
public void run() {
// Don't need to synchronize, as it only runs in one thread.

View file

@ -108,6 +108,7 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi {
/*
* Try to get an InputStream based on the file we pass in.
*/
@SuppressWarnings("removal")
private static FileInputStream getFileInputStream(final File file)
throws Exception {
return AccessController.doPrivileged(

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, 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
@ -122,7 +122,7 @@ final class TrustStoreManager {
* Create an instance of TrustStoreDescriptor for the default
* trusted KeyStore.
*/
@SuppressWarnings("Convert2Lambda")
@SuppressWarnings({"removal","Convert2Lambda"})
static TrustStoreDescriptor createInstance() {
return AccessController.doPrivileged(
new PrivilegedAction<TrustStoreDescriptor>() {
@ -385,7 +385,7 @@ final class TrustStoreManager {
}
if (!"NONE".equals(descriptor.storeName)) {
try (FileInputStream fis = AccessController.doPrivileged(
try (@SuppressWarnings("removal") FileInputStream fis = AccessController.doPrivileged(
new OpenFileInputStreamAction(descriptor.storeFile))) {
ks.load(fis, password);
} catch (FileNotFoundException fnfe) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, 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
@ -49,6 +49,7 @@ public abstract class AbstractAlgorithmConstraints
// Get algorithm constraints from the specified security property.
static List<String> getAlgorithms(String propertyName) {
@SuppressWarnings("removal")
String property = AccessController.doPrivileged(
new PrivilegedAction<String>() {
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, 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
@ -43,6 +43,7 @@ import sun.security.x509.X509CertImpl;
* The purpose of this class is to determine the trust anchor certificates is in
* the cacerts file. This is used for PKIX CertPath checking.
*/
@SuppressWarnings("removal")
public class AnchorCertificates {
private static final Debug debug = Debug.getInstance("certpath");

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, 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
@ -204,6 +204,7 @@ class DomainName {
}
private static InputStream getPubSuffixStream() {
@SuppressWarnings("removal")
InputStream is = AccessController.doPrivileged(
new PrivilegedAction<>() {
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, 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
@ -55,6 +55,7 @@ public class KeyStoreDelegator extends KeyStoreSpi {
private KeyStoreSpi keystore; // the delegate
private boolean compatModeEnabled = true;
@SuppressWarnings("removal")
public KeyStoreDelegator(
String primaryType,
Class<? extends KeyStoreSpi> primaryKeyStore,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -42,6 +42,7 @@ public class SecurityProperties {
* @param propName the name of the system or security property
* @return the value of the system or security property
*/
@SuppressWarnings("removal")
public static String privilegedGetOverridable(String propName) {
if (System.getSecurityManager() == null) {
return getOverridableProperty(propName);

View file

@ -42,6 +42,7 @@ import sun.security.x509.X509CertImpl;
* <b>Attention</b>: This check is NOT meant to replace the standard PKI-defined
* validation check, neither is it used as an alternative to CRL.
*/
@SuppressWarnings("removal")
public final class UntrustedCertificates {
private static final Debug debug = Debug.getInstance("certpath");

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, 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
@ -70,6 +70,7 @@ enum CADistrustPolicy {
// The policies set in the jdk.security.caDistrustPolicies property.
static final EnumSet<CADistrustPolicy> POLICIES = parseProperty();
private static EnumSet<CADistrustPolicy> parseProperty() {
@SuppressWarnings("removal")
String property = AccessController.doPrivileged(
new PrivilegedAction<>() {
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2021, 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
@ -1341,6 +1341,7 @@ public class X500Name implements GeneralNameInterface, Principal {
}
};
try {
@SuppressWarnings("removal")
Object[] result = AccessController.doPrivileged(pa);
@SuppressWarnings("unchecked")
Constructor<X500Principal> constr =

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, 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
@ -57,6 +57,7 @@ import sun.security.action.GetPropertyAction;
* <p>
* @since 1.8
*/
@SuppressWarnings("removal")
public final class ZoneInfoFile {
/**

View file

@ -77,6 +77,7 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
parentLocalesMap.put(Locale.US, Locale.US);
}
@SuppressWarnings("removal")
public CLDRLocaleProviderAdapter() {
LocaleDataMetaInfo nbmi;
@ -113,6 +114,7 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
@Override
public CalendarDataProvider getCalendarDataProvider() {
if (calendarDataProvider == null) {
@SuppressWarnings("removal")
CalendarDataProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CalendarDataProvider>) () ->
new CLDRCalendarDataProviderImpl(
@ -131,6 +133,7 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
@Override
public CalendarNameProvider getCalendarNameProvider() {
if (calendarNameProvider == null) {
@SuppressWarnings("removal")
CalendarNameProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CalendarNameProvider>) ()
-> new CLDRCalendarNameProviderImpl(
@ -154,6 +157,7 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
@Override
public TimeZoneNameProvider getTimeZoneNameProvider() {
if (timeZoneNameProvider == null) {
@SuppressWarnings("removal")
TimeZoneNameProvider provider = AccessController.doPrivileged(
(PrivilegedAction<TimeZoneNameProvider>) () ->
new CLDRTimeZoneNameProviderImpl(

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, 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
@ -186,6 +186,7 @@ public abstract class AuxLocaleProviderAdapter extends LocaleProviderAdapter {
* A dummy locale service provider that indicates there is no
* provider available
*/
@SuppressWarnings("removal")
private static final NullProvider NULL_PROVIDER = AccessController.doPrivileged(
(PrivilegedAction<NullProvider>) () -> new NullProvider());

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, 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
@ -142,6 +142,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public BreakIteratorProvider getBreakIteratorProvider() {
if (breakIteratorProvider == null) {
@SuppressWarnings("removal")
BreakIteratorProvider provider = AccessController.doPrivileged(
(PrivilegedAction<BreakIteratorProvider>) () ->
new BreakIteratorProviderImpl(
@ -160,6 +161,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public CollatorProvider getCollatorProvider() {
if (collatorProvider == null) {
@SuppressWarnings("removal")
CollatorProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CollatorProvider>) () ->
new CollatorProviderImpl(
@ -178,6 +180,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public DateFormatProvider getDateFormatProvider() {
if (dateFormatProvider == null) {
@SuppressWarnings("removal")
DateFormatProvider provider = AccessController.doPrivileged(
(PrivilegedAction<DateFormatProvider>) () ->
new DateFormatProviderImpl(
@ -196,6 +199,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public DateFormatSymbolsProvider getDateFormatSymbolsProvider() {
if (dateFormatSymbolsProvider == null) {
@SuppressWarnings("removal")
DateFormatSymbolsProvider provider = AccessController.doPrivileged(
(PrivilegedAction<DateFormatSymbolsProvider>) () ->
new DateFormatSymbolsProviderImpl(
@ -214,6 +218,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
if (decimalFormatSymbolsProvider == null) {
@SuppressWarnings("removal")
DecimalFormatSymbolsProvider provider = AccessController.doPrivileged(
(PrivilegedAction<DecimalFormatSymbolsProvider>) () ->
new DecimalFormatSymbolsProviderImpl(
@ -232,6 +237,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public NumberFormatProvider getNumberFormatProvider() {
if (numberFormatProvider == null) {
@SuppressWarnings("removal")
NumberFormatProvider provider = AccessController.doPrivileged(
(PrivilegedAction<NumberFormatProvider>) () ->
new NumberFormatProviderImpl(
@ -253,6 +259,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public CurrencyNameProvider getCurrencyNameProvider() {
if (currencyNameProvider == null) {
@SuppressWarnings("removal")
CurrencyNameProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CurrencyNameProvider>) () ->
new CurrencyNameProviderImpl(
@ -271,6 +278,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public LocaleNameProvider getLocaleNameProvider() {
if (localeNameProvider == null) {
@SuppressWarnings("removal")
LocaleNameProvider provider = AccessController.doPrivileged(
(PrivilegedAction<LocaleNameProvider>) () ->
new LocaleNameProviderImpl(
@ -289,6 +297,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public TimeZoneNameProvider getTimeZoneNameProvider() {
if (timeZoneNameProvider == null) {
@SuppressWarnings("removal")
TimeZoneNameProvider provider = AccessController.doPrivileged(
(PrivilegedAction<TimeZoneNameProvider>) () ->
new TimeZoneNameProviderImpl(
@ -307,6 +316,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public CalendarDataProvider getCalendarDataProvider() {
if (calendarDataProvider == null) {
@SuppressWarnings("removal")
CalendarDataProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CalendarDataProvider>) () ->
new CalendarDataProviderImpl(
@ -325,6 +335,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public CalendarNameProvider getCalendarNameProvider() {
if (calendarNameProvider == null) {
@SuppressWarnings("removal")
CalendarNameProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CalendarNameProvider>) () ->
new CalendarNameProviderImpl(
@ -346,6 +357,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public CalendarProvider getCalendarProvider() {
if (calendarProvider == null) {
@SuppressWarnings("removal")
CalendarProvider provider = AccessController.doPrivileged(
(PrivilegedAction<CalendarProvider>) () ->
new CalendarProviderImpl(
@ -367,6 +379,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
@Override
public JavaTimeDateTimePatternProvider getJavaTimeDateTimePatternProvider() {
if (javaTimeDateTimePatternProvider == null) {
@SuppressWarnings("removal")
JavaTimeDateTimePatternProvider provider = AccessController.doPrivileged(
(PrivilegedAction<JavaTimeDateTimePatternProvider>) ()
-> new JavaTimeDateTimePatternImpl(
@ -459,6 +472,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
// Use ServiceLoader to dynamically acquire installed locales' tags.
try {
@SuppressWarnings("removal")
String nonBaseTags = AccessController.doPrivileged((PrivilegedExceptionAction<String>) () -> {
StringBuilder tags = new StringBuilder();
for (LocaleDataMetaInfo ldmi :

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, 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
@ -69,6 +69,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
return LocaleProviderAdapter.Type.SPI;
}
@SuppressWarnings("removal")
@Override
protected <P extends LocaleServiceProvider> P findInstalledProvider(final Class<P> c) {
try {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, 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
@ -80,6 +80,7 @@ public abstract class BreakIteratorResourceBundle extends ResourceBundle {
return data;
}
@SuppressWarnings("removal")
private InputStream getResourceAsStream(String path) throws Exception {
PrivilegedExceptionAction<InputStream> pa;
pa = () -> getClass().getModule().getResourceAsStream(path);

View file

@ -255,6 +255,7 @@ public abstract class Bundles {
/**
* Loads ResourceBundle from service providers.
*/
@SuppressWarnings("removal")
private static ResourceBundle loadBundleFromProviders(String baseName,
Locale locale,
ServiceLoader<ResourceBundleProvider> providers,

View file

@ -178,6 +178,7 @@ public class LocaleData {
return getBundle(type.getTextResourcesPackage() + ".FormatData", locale);
}
@SuppressWarnings("removal")
public static ResourceBundle getBundle(final String baseName, final Locale locale) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
@ -187,6 +188,7 @@ public class LocaleData {
});
}
@SuppressWarnings("removal")
private static OpenListResourceBundle getSupplementary(final String baseName, final Locale locale) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override