8267521: Post JEP 411 refactoring: maximum covering > 50K

Reviewed-by: dfuchs, prr
This commit is contained in:
Weijun Wang 2021-06-02 15:48:50 +00:00
parent 40d23a0c0b
commit 508cec7535
18 changed files with 205 additions and 104 deletions

View File

@ -178,7 +178,6 @@ import java.util.concurrent.locks.Condition;
* @since 1.7 * @since 1.7
* @author Doug Lea * @author Doug Lea
*/ */
@SuppressWarnings("removal")
public class ForkJoinPool extends AbstractExecutorService { public class ForkJoinPool extends AbstractExecutorService {
/* /*
@ -751,11 +750,13 @@ public class ForkJoinPool extends AbstractExecutorService {
* permission to modify threads. * permission to modify threads.
*/ */
private static void checkPermission() { private static void checkPermission() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
if (security != null) if (security != null)
security.checkPermission(modifyThreadPermission); security.checkPermission(modifyThreadPermission);
} }
@SuppressWarnings("removal")
static AccessControlContext contextWithPermissions(Permission ... perms) { static AccessControlContext contextWithPermissions(Permission ... perms) {
Permissions permissions = new Permissions(); Permissions permissions = new Permissions();
for (Permission perm : perms) for (Permission perm : perms)
@ -799,9 +800,11 @@ public class ForkJoinPool extends AbstractExecutorService {
static final class DefaultForkJoinWorkerThreadFactory static final class DefaultForkJoinWorkerThreadFactory
implements ForkJoinWorkerThreadFactory { implements ForkJoinWorkerThreadFactory {
// ACC for access to the factory // ACC for access to the factory
@SuppressWarnings("removal")
private static final AccessControlContext ACC = contextWithPermissions( private static final AccessControlContext ACC = contextWithPermissions(
new RuntimePermission("getClassLoader"), new RuntimePermission("getClassLoader"),
new RuntimePermission("setContextClassLoader")); new RuntimePermission("setContextClassLoader"));
@SuppressWarnings("removal")
public final ForkJoinWorkerThread newThread(ForkJoinPool pool) { public final ForkJoinWorkerThread newThread(ForkJoinPool pool) {
return AccessController.doPrivileged( return AccessController.doPrivileged(
new PrivilegedAction<>() { new PrivilegedAction<>() {
@ -821,6 +824,7 @@ public class ForkJoinPool extends AbstractExecutorService {
*/ */
static final class DefaultCommonPoolForkJoinWorkerThreadFactory static final class DefaultCommonPoolForkJoinWorkerThreadFactory
implements ForkJoinWorkerThreadFactory { implements ForkJoinWorkerThreadFactory {
@SuppressWarnings("removal")
private static final AccessControlContext ACC = contextWithPermissions( private static final AccessControlContext ACC = contextWithPermissions(
modifyThreadPermission, modifyThreadPermission,
new RuntimePermission("enableContextClassLoaderOverride"), new RuntimePermission("enableContextClassLoaderOverride"),
@ -828,6 +832,7 @@ public class ForkJoinPool extends AbstractExecutorService {
new RuntimePermission("getClassLoader"), new RuntimePermission("getClassLoader"),
new RuntimePermission("setContextClassLoader")); new RuntimePermission("setContextClassLoader"));
@SuppressWarnings("removal")
public final ForkJoinWorkerThread newThread(ForkJoinPool pool) { public final ForkJoinWorkerThread newThread(ForkJoinPool pool) {
return AccessController.doPrivileged( return AccessController.doPrivileged(
new PrivilegedAction<>() { new PrivilegedAction<>() {
@ -1253,11 +1258,13 @@ public class ForkJoinPool extends AbstractExecutorService {
// misc // misc
/** AccessControlContext for innocuous workers, created on 1st use. */ /** AccessControlContext for innocuous workers, created on 1st use. */
@SuppressWarnings("removal")
private static AccessControlContext INNOCUOUS_ACC; private static AccessControlContext INNOCUOUS_ACC;
/** /**
* Initializes (upon registration) InnocuousForkJoinWorkerThreads. * Initializes (upon registration) InnocuousForkJoinWorkerThreads.
*/ */
@SuppressWarnings("removal")
final void initializeInnocuousWorker() { final void initializeInnocuousWorker() {
AccessControlContext acc; // racy construction OK AccessControlContext acc; // racy construction OK
if ((acc = INNOCUOUS_ACC) == null) if ((acc = INNOCUOUS_ACC) == null)
@ -3497,9 +3504,11 @@ public class ForkJoinPool extends AbstractExecutorService {
defaultForkJoinWorkerThreadFactory = defaultForkJoinWorkerThreadFactory =
new DefaultForkJoinWorkerThreadFactory(); new DefaultForkJoinWorkerThreadFactory();
modifyThreadPermission = new RuntimePermission("modifyThread"); modifyThreadPermission = new RuntimePermission("modifyThread");
common = AccessController.doPrivileged(new PrivilegedAction<>() { @SuppressWarnings("removal")
ForkJoinPool tmp = AccessController.doPrivileged(new PrivilegedAction<>() {
public ForkJoinPool run() { public ForkJoinPool run() {
return new ForkJoinPool((byte)0); }}); return new ForkJoinPool((byte)0); }});
common = tmp;
COMMON_PARALLELISM = Math.max(common.mode & SMASK, 1); COMMON_PARALLELISM = Math.max(common.mode & SMASK, 1);
} }

View File

@ -48,7 +48,6 @@ import sun.net.ftp.*;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
@SuppressWarnings("removal")
public class FtpClient extends sun.net.ftp.FtpClient { public class FtpClient extends sun.net.ftp.FtpClient {
private static int defaultSoTimeout; private static int defaultSoTimeout;
@ -111,16 +110,13 @@ public class FtpClient extends sun.net.ftp.FtpClient {
static { static {
final int vals[] = {0, 0}; final int vals[] = {0, 0};
final String encs[] = {null}; @SuppressWarnings("removal")
final String enc = AccessController.doPrivileged(
AccessController.doPrivileged( new PrivilegedAction<String>() {
new PrivilegedAction<Object>() { public String run() {
public Object run() {
vals[0] = Integer.getInteger("sun.net.client.defaultReadTimeout", 300_000).intValue(); vals[0] = Integer.getInteger("sun.net.client.defaultReadTimeout", 300_000).intValue();
vals[1] = Integer.getInteger("sun.net.client.defaultConnectTimeout", 300_000).intValue(); vals[1] = Integer.getInteger("sun.net.client.defaultConnectTimeout", 300_000).intValue();
encs[0] = System.getProperty("file.encoding", "ISO8859_1"); return System.getProperty("file.encoding", "ISO8859_1");
return null;
} }
}); });
if (vals[0] == 0) { if (vals[0] == 0) {
@ -135,7 +131,7 @@ public class FtpClient extends sun.net.ftp.FtpClient {
defaultConnectTimeout = vals[1]; defaultConnectTimeout = vals[1];
} }
encoding = encs[0]; encoding = enc;
try { try {
if (!isASCIISuperset(encoding)) { if (!isASCIISuperset(encoding)) {
encoding = "ISO8859_1"; encoding = "ISO8859_1";
@ -632,13 +628,10 @@ public class FtpClient extends sun.net.ftp.FtpClient {
Socket s; Socket s;
if (proxy != null) { if (proxy != null) {
if (proxy.type() == Proxy.Type.SOCKS) { if (proxy.type() == Proxy.Type.SOCKS) {
s = AccessController.doPrivileged( PrivilegedAction<Socket> pa = () -> new Socket(proxy);
new PrivilegedAction<Socket>() { @SuppressWarnings("removal")
var tmp = AccessController.doPrivileged(pa);
public Socket run() { s = tmp;
return new Socket(proxy);
}
});
} else { } else {
s = new Socket(Proxy.NO_PROXY); s = new Socket(Proxy.NO_PROXY);
} }
@ -646,13 +639,9 @@ public class FtpClient extends sun.net.ftp.FtpClient {
s = new Socket(); s = new Socket();
} }
InetAddress serverAddress = AccessController.doPrivileged( PrivilegedAction<InetAddress> pa = () -> server.getLocalAddress();
new PrivilegedAction<InetAddress>() { @SuppressWarnings("removal")
@Override InetAddress serverAddress = AccessController.doPrivileged(pa);
public InetAddress run() {
return server.getLocalAddress();
}
});
// Bind the socket to the same address as the control channel. This // Bind the socket to the same address as the control channel. This
// is needed in case of multi-homed systems. // is needed in case of multi-homed systems.
@ -925,13 +914,10 @@ public class FtpClient extends sun.net.ftp.FtpClient {
Socket s; Socket s;
if (proxy != null) { if (proxy != null) {
if (proxy.type() == Proxy.Type.SOCKS) { if (proxy.type() == Proxy.Type.SOCKS) {
s = AccessController.doPrivileged( PrivilegedAction<Socket> pa = () -> new Socket(proxy);
new PrivilegedAction<Socket>() { @SuppressWarnings("removal")
var tmp = AccessController.doPrivileged(pa);
public Socket run() { s = tmp;
return new Socket(proxy);
}
});
} else { } else {
s = new Socket(Proxy.NO_PROXY); s = new Socket(Proxy.NO_PROXY);
} }

View File

@ -59,7 +59,6 @@ import java.util.NoSuchElementException;
import sun.java2d.Disposer; import sun.java2d.Disposer;
import sun.java2d.DisposerRecord; import sun.java2d.DisposerRecord;
@SuppressWarnings("removal")
public class JPEGImageReader extends ImageReader { public class JPEGImageReader extends ImageReader {
private boolean debug = false; private boolean debug = false;
@ -87,6 +86,11 @@ public class JPEGImageReader extends ImageReader {
private int numImages = 0; private int numImages = 0;
static { static {
initStatic();
}
@SuppressWarnings("removal")
private static void initStatic() {
java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() { new java.security.PrivilegedAction<Void>() {
@Override @Override

View File

@ -63,7 +63,6 @@ import org.w3c.dom.Node;
import sun.java2d.Disposer; import sun.java2d.Disposer;
import sun.java2d.DisposerRecord; import sun.java2d.DisposerRecord;
@SuppressWarnings("removal")
public class JPEGImageWriter extends ImageWriter { public class JPEGImageWriter extends ImageWriter {
///////// Private variables ///////// Private variables
@ -173,6 +172,11 @@ public class JPEGImageWriter extends ImageWriter {
///////// static initializer ///////// static initializer
static { static {
initStatic();
}
@SuppressWarnings("removal")
private static void initStatic() {
java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() { new java.security.PrivilegedAction<Void>() {
@Override @Override

View File

@ -214,7 +214,6 @@ import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON;
* @author Arthur van Hoff * @author Arthur van Hoff
* @author Sami Shaio * @author Sami Shaio
*/ */
@SuppressWarnings("removal")
public abstract class Component implements ImageObserver, MenuContainer, public abstract class Component implements ImageObserver, MenuContainer,
Serializable Serializable
{ {
@ -506,6 +505,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
/* /*
* The component's AccessControlContext. * The component's AccessControlContext.
*/ */
@SuppressWarnings("removal")
private transient volatile AccessControlContext acc = private transient volatile AccessControlContext acc =
AccessController.getContext(); AccessController.getContext();
@ -627,13 +627,15 @@ public abstract class Component implements ImageObserver, MenuContainer,
initIDs(); initIDs();
} }
@SuppressWarnings("removal")
String s = java.security.AccessController.doPrivileged( String s = java.security.AccessController.doPrivileged(
new GetPropertyAction("awt.image.incrementaldraw")); new GetPropertyAction("awt.image.incrementaldraw"));
isInc = (s == null || s.equals("true")); isInc = (s == null || s.equals("true"));
s = java.security.AccessController.doPrivileged( @SuppressWarnings("removal")
String s2 = java.security.AccessController.doPrivileged(
new GetPropertyAction("awt.image.redrawrate")); new GetPropertyAction("awt.image.redrawrate"));
incRate = (s != null) ? Integer.parseInt(s) : 100; incRate = (s2 != null) ? Integer.parseInt(s2) : 100;
} }
/** /**
@ -712,6 +714,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
/* /*
* Returns the acc this component was constructed with. * Returns the acc this component was constructed with.
*/ */
@SuppressWarnings("removal")
final AccessControlContext getAccessControlContext() { final AccessControlContext getAccessControlContext() {
if (acc == null) { if (acc == null) {
throw new SecurityException("Component is missing AccessControlContext"); throw new SecurityException("Component is missing AccessControlContext");
@ -974,6 +977,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
comp.processEvent(e); comp.processEvent(e);
} }
@SuppressWarnings("removal")
public AccessControlContext getAccessControlContext(Component comp) { public AccessControlContext getAccessControlContext(Component comp) {
return comp.getAccessControlContext(); return comp.getAccessControlContext();
} }
@ -1427,6 +1431,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
throw new HeadlessException(); throw new HeadlessException();
} }
@SuppressWarnings("removal")
PointerInfo pi = java.security.AccessController.doPrivileged( PointerInfo pi = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<PointerInfo>() { new java.security.PrivilegedAction<PointerInfo>() {
public PointerInfo run() { public PointerInfo run() {
@ -6253,6 +6258,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
// Need to check non-bootstraps. // Need to check non-bootstraps.
@SuppressWarnings("removal")
Boolean enabled = java.security.AccessController.doPrivileged( Boolean enabled = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Boolean>() { new java.security.PrivilegedAction<Boolean>() {
public Boolean run() { public Boolean run() {
@ -8988,6 +8994,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @throws IOException if an I/O error occurs * @throws IOException if an I/O error occurs
* @see #writeObject(ObjectOutputStream) * @see #writeObject(ObjectOutputStream)
*/ */
@SuppressWarnings("removal")
@Serial @Serial
private void readObject(ObjectInputStream s) private void readObject(ObjectInputStream s)
throws ClassNotFoundException, IOException throws ClassNotFoundException, IOException

View File

@ -94,7 +94,6 @@ import sun.util.logging.PlatformLogger;
* @see LayoutManager * @see LayoutManager
* @since 1.0 * @since 1.0
*/ */
@SuppressWarnings("removal")
public class Container extends Component { public class Container extends Component {
private static final PlatformLogger log = PlatformLogger.getLogger("java.awt.Container"); private static final PlatformLogger log = PlatformLogger.getLogger("java.awt.Container");
@ -1576,12 +1575,11 @@ public class Container extends Component {
return false; return false;
} }
private static final boolean isJavaAwtSmartInvalidate; // Don't lazy-read because every app uses invalidate()
static { @SuppressWarnings("removal")
// Don't lazy-read because every app uses invalidate() private static final boolean isJavaAwtSmartInvalidate
isJavaAwtSmartInvalidate = AccessController.doPrivileged( = AccessController.doPrivileged(
new GetBooleanAction("java.awt.smartInvalidate")); new GetBooleanAction("java.awt.smartInvalidate"));
}
/** /**
* Invalidates the parent of the container unless the container * Invalidates the parent of the container unless the container
@ -2634,6 +2632,7 @@ public class Container extends Component {
if (GraphicsEnvironment.isHeadless()) { if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException(); throw new HeadlessException();
} }
@SuppressWarnings("removal")
PointerInfo pi = java.security.AccessController.doPrivileged( PointerInfo pi = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<PointerInfo>() { new java.security.PrivilegedAction<PointerInfo>() {
public PointerInfo run() { public PointerInfo run() {

View File

@ -64,7 +64,6 @@ import sun.util.logging.PlatformLogger;
* @see Component#getFocusTraversalKeys * @see Component#getFocusTraversalKeys
* @since 1.4 * @since 1.4
*/ */
@SuppressWarnings("removal")
public class DefaultKeyboardFocusManager extends KeyboardFocusManager { public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
private static final PlatformLogger focusLog = PlatformLogger.getLogger("java.awt.focus.DefaultKeyboardFocusManager"); private static final PlatformLogger focusLog = PlatformLogger.getLogger("java.awt.focus.DefaultKeyboardFocusManager");
@ -84,6 +83,11 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
private static boolean fxAppThreadIsDispatchThread; private static boolean fxAppThreadIsDispatchThread;
static { static {
initStatic();
}
@SuppressWarnings("removal")
private static void initStatic() {
AWTAccessor.setDefaultKeyboardFocusManagerAccessor( AWTAccessor.setDefaultKeyboardFocusManagerAccessor(
new AWTAccessor.DefaultKeyboardFocusManagerAccessor() { new AWTAccessor.DefaultKeyboardFocusManagerAccessor() {
public void consumeNextKeyTyped(DefaultKeyboardFocusManager dkfm, KeyEvent e) { public void consumeNextKeyTyped(DefaultKeyboardFocusManager dkfm, KeyEvent e) {

View File

@ -134,7 +134,6 @@ import sun.awt.SunToolkit;
* @author Fred Ecks * @author Fred Ecks
* @since 1.0 * @since 1.0
*/ */
@SuppressWarnings("removal")
public abstract class Toolkit { public abstract class Toolkit {
/** /**
@ -397,6 +396,7 @@ public abstract class Toolkit {
* properties are set up properly before any classes dependent upon them * properties are set up properly before any classes dependent upon them
* are initialized. * are initialized.
*/ */
@SuppressWarnings("removal")
private static void initAssistiveTechnologies() { private static void initAssistiveTechnologies() {
// Get accessibility properties // Get accessibility properties
@ -516,6 +516,7 @@ public abstract class Toolkit {
* {@code null} it is ignored. All other errors are handled via an AWTError * {@code null} it is ignored. All other errors are handled via an AWTError
* exception. * exception.
*/ */
@SuppressWarnings("removal")
private static void loadAssistiveTechnologies() { private static void loadAssistiveTechnologies() {
// Load any assistive technologies // Load any assistive technologies
if (atNames != null && !atNames.isBlank()) { if (atNames != null && !atNames.isBlank()) {
@ -1378,6 +1379,7 @@ public abstract class Toolkit {
* directly. -hung * directly. -hung
*/ */
private static boolean loaded = false; private static boolean loaded = false;
@SuppressWarnings("removal")
static void loadLibraries() { static void loadLibraries() {
if (!loaded) { if (!loaded) {
java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
@ -1392,6 +1394,11 @@ public abstract class Toolkit {
} }
static { static {
initStatic();
}
@SuppressWarnings("removal")
private static void initStatic() {
AWTAccessor.setToolkitAccessor( AWTAccessor.setToolkitAccessor(
new AWTAccessor.ToolkitAccessor() { new AWTAccessor.ToolkitAccessor() {
@Override @Override
@ -1465,6 +1472,7 @@ public abstract class Toolkit {
* @see java.awt.AWTPermission * @see java.awt.AWTPermission
*/ */
public final EventQueue getSystemEventQueue() { public final EventQueue getSystemEventQueue() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
if (security != null) { if (security != null) {
security.checkPermission(AWTPermissions.CHECK_AWT_EVENTQUEUE_PERMISSION); security.checkPermission(AWTPermissions.CHECK_AWT_EVENTQUEUE_PERMISSION);
@ -1804,6 +1812,7 @@ public abstract class Toolkit {
if (localL == null) { if (localL == null) {
return; return;
} }
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
if (security != null) { if (security != null) {
security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION); security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION);
@ -1873,6 +1882,7 @@ public abstract class Toolkit {
if (listener == null) { if (listener == null) {
return; return;
} }
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
if (security != null) { if (security != null) {
security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION); security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION);
@ -1938,6 +1948,7 @@ public abstract class Toolkit {
* @since 1.4 * @since 1.4
*/ */
public AWTEventListener[] getAWTEventListeners() { public AWTEventListener[] getAWTEventListeners() {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
if (security != null) { if (security != null) {
security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION); security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION);
@ -1990,6 +2001,7 @@ public abstract class Toolkit {
* @since 1.4 * @since 1.4
*/ */
public AWTEventListener[] getAWTEventListeners(long eventMask) { public AWTEventListener[] getAWTEventListeners(long eventMask) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
if (security != null) { if (security != null) {
security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION); security.checkPermission(AWTPermissions.ALL_AWT_EVENTS_PERMISSION);

View File

@ -164,7 +164,6 @@ import sun.util.logging.PlatformLogger;
* @see java.awt.BorderLayout * @see java.awt.BorderLayout
* @since 1.0 * @since 1.0
*/ */
@SuppressWarnings("removal")
public class Window extends Container implements Accessible { public class Window extends Container implements Accessible {
/** /**
@ -415,12 +414,14 @@ public class Window extends Container implements Accessible {
initIDs(); initIDs();
} }
@SuppressWarnings("removal")
String s = java.security.AccessController.doPrivileged( String s = java.security.AccessController.doPrivileged(
new GetPropertyAction("java.awt.syncLWRequests")); new GetPropertyAction("java.awt.syncLWRequests"));
systemSyncLWRequests = (s != null && s.equals("true")); systemSyncLWRequests = (s != null && s.equals("true"));
s = java.security.AccessController.doPrivileged( @SuppressWarnings("removal")
String s2 = java.security.AccessController.doPrivileged(
new GetPropertyAction("java.awt.Window.locationByPlatform")); new GetPropertyAction("java.awt.Window.locationByPlatform"));
locationByPlatformProp = (s != null && s.equals("true")); locationByPlatformProp = (s2 != null && s2.equals("true"));
} }
/** /**
@ -1398,6 +1399,7 @@ public class Window extends Container implements Accessible {
return warningString; return warningString;
} }
@SuppressWarnings("removal")
private void setWarningString() { private void setWarningString() {
warningString = null; warningString = null;
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
@ -1702,6 +1704,7 @@ public class Window extends Container implements Accessible {
return; return;
} }
if (exclusionType == Dialog.ModalExclusionType.TOOLKIT_EXCLUDE) { if (exclusionType == Dialog.ModalExclusionType.TOOLKIT_EXCLUDE) {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(AWTPermissions.TOOLKIT_MODALITY_PERMISSION); sm.checkPermission(AWTPermissions.TOOLKIT_MODALITY_PERMISSION);
@ -2252,6 +2255,7 @@ public class Window extends Container implements Accessible {
* @since 1.5 * @since 1.5
*/ */
public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException { public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
if (security != null) { if (security != null) {
security.checkPermission(AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); security.checkPermission(AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);

View File

@ -66,7 +66,6 @@ import sun.swing.SwingUtilities2.RepaintListener;
* @author Arnaud Weber * @author Arnaud Weber
* @since 1.2 * @since 1.2
*/ */
@SuppressWarnings("removal")
public class RepaintManager public class RepaintManager
{ {
/** /**
@ -212,15 +211,20 @@ public class RepaintManager
} }
}); });
volatileImageBufferEnabled = "true".equals(AccessController. @SuppressWarnings("removal")
var t1 = "true".equals(AccessController.
doPrivileged(new GetPropertyAction( doPrivileged(new GetPropertyAction(
"swing.volatileImageBufferEnabled", "true"))); "swing.volatileImageBufferEnabled", "true")));
volatileImageBufferEnabled = t1;
boolean headless = GraphicsEnvironment.isHeadless(); boolean headless = GraphicsEnvironment.isHeadless();
if (volatileImageBufferEnabled && headless) { if (volatileImageBufferEnabled && headless) {
volatileImageBufferEnabled = false; volatileImageBufferEnabled = false;
} }
nativeDoubleBuffering = "true".equals(AccessController.doPrivileged( @SuppressWarnings("removal")
var t2 = "true".equals(AccessController.doPrivileged(
new GetPropertyAction("awt.nativeDoubleBuffering"))); new GetPropertyAction("awt.nativeDoubleBuffering")));
nativeDoubleBuffering = t2;
@SuppressWarnings("removal")
String bs = AccessController.doPrivileged( String bs = AccessController.doPrivileged(
new GetPropertyAction("swing.bufferPerWindow")); new GetPropertyAction("swing.bufferPerWindow"));
if (headless) { if (headless) {
@ -235,8 +239,10 @@ public class RepaintManager
else { else {
BUFFER_STRATEGY_TYPE = BUFFER_STRATEGY_SPECIFIED_OFF; BUFFER_STRATEGY_TYPE = BUFFER_STRATEGY_SPECIFIED_OFF;
} }
HANDLE_TOP_LEVEL_PAINT = "true".equals(AccessController.doPrivileged( @SuppressWarnings("removal")
var t3 = "true".equals(AccessController.doPrivileged(
new GetPropertyAction("swing.handleTopLevelPaint", "true"))); new GetPropertyAction("swing.handleTopLevelPaint", "true")));
HANDLE_TOP_LEVEL_PAINT = t3;
GraphicsEnvironment ge = GraphicsEnvironment. GraphicsEnvironment ge = GraphicsEnvironment.
getLocalGraphicsEnvironment(); getLocalGraphicsEnvironment();
if (ge instanceof SunGraphicsEnvironment) { if (ge instanceof SunGraphicsEnvironment) {
@ -607,7 +613,9 @@ public class RepaintManager
} }
runnableList.add(new Runnable() { runnableList.add(new Runnable() {
public void run() { public void run() {
@SuppressWarnings("removal")
AccessControlContext stack = AccessController.getContext(); AccessControlContext stack = AccessController.getContext();
@SuppressWarnings("removal")
AccessControlContext acc = AccessControlContext acc =
AWTAccessor.getComponentAccessor().getAccessControlContext(c); AWTAccessor.getComponentAccessor().getAccessControlContext(c);
javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Void>() { javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Void>() {
@ -738,7 +746,9 @@ public class RepaintManager
int n = ic.size(); int n = ic.size();
for(int i = 0; i < n; i++) { for(int i = 0; i < n; i++) {
final Component c = ic.get(i); final Component c = ic.get(i);
@SuppressWarnings("removal")
AccessControlContext stack = AccessController.getContext(); AccessControlContext stack = AccessController.getContext();
@SuppressWarnings("removal")
AccessControlContext acc = AccessControlContext acc =
AWTAccessor.getComponentAccessor().getAccessControlContext(c); AWTAccessor.getComponentAccessor().getAccessControlContext(c);
javaSecurityAccess.doIntersectionPrivilege( javaSecurityAccess.doIntersectionPrivilege(
@ -844,7 +854,9 @@ public class RepaintManager
for (int j=0 ; j < count.get(); j++) { for (int j=0 ; j < count.get(); j++) {
final int i = j; final int i = j;
final Component dirtyComponent = roots.get(j); final Component dirtyComponent = roots.get(j);
@SuppressWarnings("removal")
AccessControlContext stack = AccessController.getContext(); AccessControlContext stack = AccessController.getContext();
@SuppressWarnings("removal")
AccessControlContext acc = AccessControlContext acc =
AWTAccessor.getComponentAccessor().getAccessControlContext(dirtyComponent); AWTAccessor.getComponentAccessor().getAccessControlContext(dirtyComponent);
javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Void>() { javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Void>() {

View File

@ -113,7 +113,6 @@ import static java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VBGR;
import static java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB; import static java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB;
import static java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON; import static java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON;
@SuppressWarnings("removal")
public abstract class SunToolkit extends Toolkit public abstract class SunToolkit extends Toolkit
implements ComponentFactory, InputMethodSupport, KeyboardFocusManagerPeerProvider { implements ComponentFactory, InputMethodSupport, KeyboardFocusManagerPeerProvider {
@ -121,6 +120,11 @@ public abstract class SunToolkit extends Toolkit
/* Load debug settings for native code */ /* Load debug settings for native code */
static { static {
initStatic();
}
@SuppressWarnings("removal")
private static void initStatic() {
if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.nativedebug"))) { if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.nativedebug"))) {
DebugSettings.init(); DebugSettings.init();
} }
@ -668,6 +672,7 @@ public abstract class SunToolkit extends Toolkit
* Returns the value of "sun.awt.noerasebackground" property. Default * Returns the value of "sun.awt.noerasebackground" property. Default
* value is {@code false}. * value is {@code false}.
*/ */
@SuppressWarnings("removal")
public static boolean getSunAwtNoerasebackground() { public static boolean getSunAwtNoerasebackground() {
return AccessController.doPrivileged(new GetBooleanAction("sun.awt.noerasebackground")); return AccessController.doPrivileged(new GetBooleanAction("sun.awt.noerasebackground"));
} }
@ -676,6 +681,7 @@ public abstract class SunToolkit extends Toolkit
* Returns the value of "sun.awt.erasebackgroundonresize" property. Default * Returns the value of "sun.awt.erasebackgroundonresize" property. Default
* value is {@code false}. * value is {@code false}.
*/ */
@SuppressWarnings("removal")
public static boolean getSunAwtErasebackgroundonresize() { public static boolean getSunAwtErasebackgroundonresize() {
return AccessController.doPrivileged(new GetBooleanAction("sun.awt.erasebackgroundonresize")); return AccessController.doPrivileged(new GetBooleanAction("sun.awt.erasebackgroundonresize"));
} }
@ -895,6 +901,7 @@ public abstract class SunToolkit extends Toolkit
} }
private static void checkPermissions(String filename) { private static void checkPermissions(String filename) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
if (security != null) { if (security != null) {
security.checkRead(filename); security.checkRead(filename);
@ -902,6 +909,7 @@ public abstract class SunToolkit extends Toolkit
} }
private static void checkPermissions(URL url) { private static void checkPermissions(URL url) {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
try { try {
@ -1109,6 +1117,7 @@ public abstract class SunToolkit extends Toolkit
public boolean canPopupOverlapTaskBar() { public boolean canPopupOverlapTaskBar() {
boolean result = true; boolean result = true;
try { try {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION); sm.checkPermission(AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
@ -1149,6 +1158,7 @@ public abstract class SunToolkit extends Toolkit
/** /**
* Returns the locale in which the runtime was started. * Returns the locale in which the runtime was started.
*/ */
@SuppressWarnings("removal")
public static Locale getStartupLocale() { public static Locale getStartupLocale() {
if (startupLocale == null) { if (startupLocale == null) {
String language, region, country, variant; String language, region, country, variant;
@ -1192,6 +1202,7 @@ public abstract class SunToolkit extends Toolkit
* @return {@code true}, if XEmbed is needed, {@code false} otherwise * @return {@code true}, if XEmbed is needed, {@code false} otherwise
*/ */
public static boolean needsXEmbed() { public static boolean needsXEmbed() {
@SuppressWarnings("removal")
String noxembed = AccessController. String noxembed = AccessController.
doPrivileged(new GetPropertyAction("sun.awt.noxembed", "false")); doPrivileged(new GetPropertyAction("sun.awt.noxembed", "false"));
if ("true".equals(noxembed)) { if ("true".equals(noxembed)) {
@ -1225,6 +1236,7 @@ public abstract class SunToolkit extends Toolkit
* developer. If true, Toolkit should return an * developer. If true, Toolkit should return an
* XEmbed-server-enabled CanvasPeer instead of the ordinary CanvasPeer. * XEmbed-server-enabled CanvasPeer instead of the ordinary CanvasPeer.
*/ */
@SuppressWarnings("removal")
protected final boolean isXEmbedServerRequested() { protected final boolean isXEmbedServerRequested() {
return AccessController.doPrivileged(new GetBooleanAction("sun.awt.xembedserver")); return AccessController.doPrivileged(new GetBooleanAction("sun.awt.xembedserver"));
} }
@ -1745,6 +1757,7 @@ public abstract class SunToolkit extends Toolkit
* to be inapplicable in that case. In that headless case although * to be inapplicable in that case. In that headless case although
* this method will return "true" the toolkit will return a null map. * this method will return "true" the toolkit will return a null map.
*/ */
@SuppressWarnings("removal")
private static boolean useSystemAAFontSettings() { private static boolean useSystemAAFontSettings() {
if (!checkedSystemAAFontSettings) { if (!checkedSystemAAFontSettings) {
useSystemAAFontSettings = true; /* initially set this true */ useSystemAAFontSettings = true; /* initially set this true */
@ -1848,6 +1861,7 @@ public abstract class SunToolkit extends Toolkit
* Returns the value of "sun.awt.disableMixing" property. Default * Returns the value of "sun.awt.disableMixing" property. Default
* value is {@code false}. * value is {@code false}.
*/ */
@SuppressWarnings("removal")
public static synchronized boolean getSunAwtDisableMixing() { public static synchronized boolean getSunAwtDisableMixing() {
if (sunAwtDisableMixing == null) { if (sunAwtDisableMixing == null) {
sunAwtDisableMixing = AccessController.doPrivileged( sunAwtDisableMixing = AccessController.doPrivileged(

View File

@ -62,7 +62,6 @@ import sun.util.logging.PlatformLogger;
* implementations. The platform specific parts are declared as abstract * implementations. The platform specific parts are declared as abstract
* methods that have to be implemented by specific implementations. * methods that have to be implemented by specific implementations.
*/ */
@SuppressWarnings("removal")
public abstract class SunFontManager implements FontSupport, FontManagerForSGE { public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
private static class TTFilter implements FilenameFilter { private static class TTFilter implements FilenameFilter {
@ -266,6 +265,11 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
private static int maxSoftRefCnt = 10; private static int maxSoftRefCnt = 10;
static { static {
initStatic();
}
@SuppressWarnings("removal")
private static void initStatic() {
AccessController.doPrivileged(new PrivilegedAction<Void>() { AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() { public Void run() {
FontManagerNativeLibrary.load(); FontManagerNativeLibrary.load();
@ -306,6 +310,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
/* Initialise ptrs used by JNI methods */ /* Initialise ptrs used by JNI methods */
private static native void initIDs(); private static native void initIDs();
@SuppressWarnings("removal")
protected SunFontManager() { protected SunFontManager() {
AccessController.doPrivileged(new PrivilegedAction<Void>() { AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() { public Void run() {
@ -1112,6 +1117,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
private boolean haveCheckedUnreferencedFontFiles; private boolean haveCheckedUnreferencedFontFiles;
@SuppressWarnings("removal")
private String[] getFontFilesFromPath(boolean noType1) { private String[] getFontFilesFromPath(boolean noType1) {
final FilenameFilter filter; final FilenameFilter filter;
if (noType1) { if (noType1) {
@ -1446,6 +1452,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
return new HashMap<>(0); return new HashMap<>(0);
} }
@SuppressWarnings("removal")
Font2D findFontFromPlatformMap(String lcName, int style) { Font2D findFontFromPlatformMap(String lcName, int style) {
HashMap<String, FamilyDescription> platformFontMap = SunFontManager.platformFontMap; HashMap<String, FamilyDescription> platformFontMap = SunFontManager.platformFontMap;
if (platformFontMap == null) { if (platformFontMap == null) {
@ -1739,6 +1746,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
} else if (pathDirs.length==1) { } else if (pathDirs.length==1) {
return pathDirs[0] + File.separator + s; return pathDirs[0] + File.separator + s;
} else { } else {
@SuppressWarnings("removal")
String path = AccessController.doPrivileged( String path = AccessController.doPrivileged(
new PrivilegedAction<String>() { new PrivilegedAction<String>() {
public String run() { public String run() {
@ -2204,6 +2212,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
private int createdFontCount = 0; private int createdFontCount = 0;
@SuppressWarnings("removal")
public Font2D[] createFont2D(File fontFile, int fontFormat, boolean all, public Font2D[] createFont2D(File fontFile, int fontFormat, boolean all,
boolean isCopy, CreatedFontTracker tracker) boolean isCopy, CreatedFontTracker tracker)
throws FontFormatException { throws FontFormatException {
@ -2952,6 +2961,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
return fontPath; return fontPath;
} }
@SuppressWarnings("removal")
protected void loadFonts() { protected void loadFonts() {
if (discoveredAllFonts) { if (discoveredAllFonts) {
return; return;
@ -3069,6 +3079,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
return defaultFontName; return defaultFontName;
} }
@SuppressWarnings("removal")
public void loadFontFiles() { public void loadFontFiles() {
loadFonts(); loadFonts();
if (loadedAllFontFiles) { if (loadedAllFontFiles) {
@ -3433,6 +3444,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
// Provides an aperture to add native font family names to the map // Provides an aperture to add native font family names to the map
protected void addNativeFontFamilyNames(TreeMap<String, String> familyNames, Locale requestedLocale) { } protected void addNativeFontFamilyNames(TreeMap<String, String> familyNames, Locale requestedLocale) { }
@SuppressWarnings("removal")
public void register1dot0Fonts() { public void register1dot0Fonts() {
AccessController.doPrivileged(new PrivilegedAction<Void>() { AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() { public Void run() {
@ -3472,6 +3484,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
* on windows and uses that if set. * on windows and uses that if set.
*/ */
private static Locale systemLocale = null; private static Locale systemLocale = null;
@SuppressWarnings("removal")
private static Locale getSystemStartupLocale() { private static Locale getSystemStartupLocale() {
if (systemLocale == null) { if (systemLocale == null) {
systemLocale = AccessController.doPrivileged(new PrivilegedAction<Locale>() { systemLocale = AccessController.doPrivileged(new PrivilegedAction<Locale>() {

View File

@ -104,7 +104,6 @@ import javax.print.attribute.standard.Media;
* *
* @author Richard Blanchard * @author Richard Blanchard
*/ */
@SuppressWarnings("removal")
public class PSPrinterJob extends RasterPrinterJob { public class PSPrinterJob extends RasterPrinterJob {
/* Class Constants */ /* Class Constants */
@ -335,6 +334,11 @@ public class PSPrinterJob extends RasterPrinterJob {
/* Class static initialiser block */ /* Class static initialiser block */
static { static {
initStatic();
}
@SuppressWarnings("removal")
private static void initStatic() {
//enable priviledges so initProps can access system properties, //enable priviledges so initProps can access system properties,
// open the property file, etc. // open the property file, etc.
java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
@ -504,6 +508,7 @@ public class PSPrinterJob extends RasterPrinterJob {
* this method is called to mark the start of a * this method is called to mark the start of a
* document. * document.
*/ */
@SuppressWarnings("removal")
protected void startDoc() throws PrinterException { protected void startDoc() throws PrinterException {
// A security check has been performed in the // A security check has been performed in the
@ -758,6 +763,7 @@ public class PSPrinterJob extends RasterPrinterJob {
/** /**
* Invoked if the application cancelled the printjob. * Invoked if the application cancelled the printjob.
*/ */
@SuppressWarnings("removal")
protected void abortDoc() { protected void abortDoc() {
if (mPSStream != null && mDestType != RasterPrinterJob.STREAM) { if (mPSStream != null && mDestType != RasterPrinterJob.STREAM) {
mPSStream.close(); mPSStream.close();
@ -779,6 +785,7 @@ public class PSPrinterJob extends RasterPrinterJob {
* this method is called after that last page * this method is called after that last page
* has been imaged. * has been imaged.
*/ */
@SuppressWarnings("removal")
protected void endDoc() throws PrinterException { protected void endDoc() throws PrinterException {
if (mPSStream != null) { if (mPSStream != null) {
mPSStream.println(EOF_COMMENT); mPSStream.println(EOF_COMMENT);
@ -848,6 +855,7 @@ public class PSPrinterJob extends RasterPrinterJob {
paperWidth + " " + paperHeight + "]"); paperWidth + " " + paperHeight + "]");
final PrintService pservice = getPrintService(); final PrintService pservice = getPrintService();
@SuppressWarnings("removal")
Boolean isPS = java.security.AccessController.doPrivileged( Boolean isPS = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Boolean>() { new java.security.PrivilegedAction<Boolean>() {
public Boolean run() { public Boolean run() {

View File

@ -313,7 +313,6 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
// XXX - there are probably a lot of redundant values that could be removed. // XXX - there are probably a lot of redundant values that could be removed.
// ie. Take a look at RadioButtonBorder, etc... // ie. Take a look at RadioButtonBorder, etc...
@SuppressWarnings("removal")
protected void initComponentDefaults(UIDefaults table) protected void initComponentDefaults(UIDefaults table)
{ {
super.initComponentDefaults( table ); super.initComponentDefaults( table );
@ -594,16 +593,19 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
if (!(this instanceof WindowsClassicLookAndFeel) && if (!(this instanceof WindowsClassicLookAndFeel) &&
(OSInfo.getOSType() == OSInfo.OSType.WINDOWS && (OSInfo.getOSType() == OSInfo.OSType.WINDOWS &&
OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_XP) >= 0) && OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_XP) >= 0)) {
AccessController.doPrivileged(new GetPropertyAction("swing.noxp")) == null) { @SuppressWarnings("removal")
String prop = AccessController.doPrivileged(new GetPropertyAction("swing.noxp"));
if (prop == null) {
// These desktop properties are not used directly, but are needed to // These desktop properties are not used directly, but are needed to
// trigger realoading of UI's. // trigger realoading of UI's.
this.themeActive = new TriggerDesktopProperty("win.xpstyle.themeActive"); this.themeActive = new TriggerDesktopProperty("win.xpstyle.themeActive");
this.dllName = new TriggerDesktopProperty("win.xpstyle.dllName"); this.dllName = new TriggerDesktopProperty("win.xpstyle.dllName");
this.colorName = new TriggerDesktopProperty("win.xpstyle.colorName"); this.colorName = new TriggerDesktopProperty("win.xpstyle.colorName");
this.sizeName = new TriggerDesktopProperty("win.xpstyle.sizeName"); this.sizeName = new TriggerDesktopProperty("win.xpstyle.sizeName");
}
} }

View File

@ -152,10 +152,7 @@ import static jdk.internal.logger.DefaultLoggerFinder.isSystem;
* @since 1.4 * @since 1.4
*/ */
@SuppressWarnings("removal")
public class LogManager { public class LogManager {
// The global LogManager object
private static final LogManager manager;
// 'props' is assigned within a lock but accessed without it. // 'props' is assigned within a lock but accessed without it.
// Declaring it volatile makes sure that another thread will not // Declaring it volatile makes sure that another thread will not
@ -220,39 +217,40 @@ public class LogManager {
private final Map<Object, Runnable> listeners = private final Map<Object, Runnable> listeners =
Collections.synchronizedMap(new IdentityHashMap<>()); Collections.synchronizedMap(new IdentityHashMap<>());
static { // The global LogManager object
manager = AccessController.doPrivileged(new PrivilegedAction<LogManager>() { @SuppressWarnings("removal")
@Override private static final LogManager manager = AccessController.doPrivileged(
public LogManager run() { new PrivilegedAction<LogManager>() {
LogManager mgr = null; @Override
String cname = null; public LogManager run() {
try { LogManager mgr = null;
cname = System.getProperty("java.util.logging.manager"); String cname = null;
if (cname != null) { try {
try { cname = System.getProperty("java.util.logging.manager");
@SuppressWarnings("deprecation") if (cname != null) {
Object tmp = ClassLoader.getSystemClassLoader() try {
.loadClass(cname).newInstance(); @SuppressWarnings("deprecation")
mgr = (LogManager) tmp; Object tmp = ClassLoader.getSystemClassLoader()
} catch (ClassNotFoundException ex) { .loadClass(cname).newInstance();
@SuppressWarnings("deprecation") mgr = (LogManager) tmp;
Object tmp = Thread.currentThread() } catch (ClassNotFoundException ex) {
.getContextClassLoader().loadClass(cname).newInstance(); @SuppressWarnings("deprecation")
mgr = (LogManager) tmp; Object tmp = Thread.currentThread()
.getContextClassLoader().loadClass(cname).newInstance();
mgr = (LogManager) tmp;
}
} }
} catch (Exception ex) {
System.err.println("Could not load Logmanager \"" + cname + "\"");
ex.printStackTrace();
} }
} catch (Exception ex) { if (mgr == null) {
System.err.println("Could not load Logmanager \"" + cname + "\""); mgr = new LogManager();
ex.printStackTrace(); }
} return mgr;
if (mgr == null) {
mgr = new LogManager();
}
return mgr;
} }
}); });
}
// This private class is used as a shutdown hook. // This private class is used as a shutdown hook.
// It does a "reset" to close all open handlers. // It does a "reset" to close all open handlers.
@ -307,6 +305,7 @@ public class LogManager {
} }
private static Void checkSubclassPermissions() { private static Void checkSubclassPermissions() {
@SuppressWarnings("removal")
final SecurityManager sm = System.getSecurityManager(); final SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
// These permission will be checked in the LogManager constructor, // These permission will be checked in the LogManager constructor,
@ -338,6 +337,7 @@ public class LogManager {
*/ */
private boolean initializedCalled = false; private boolean initializedCalled = false;
private volatile boolean initializationDone = false; private volatile boolean initializationDone = false;
@SuppressWarnings("removal")
final void ensureLogManagerInitialized() { final void ensureLogManagerInitialized() {
final LogManager owner = this; final LogManager owner = this;
if (initializationDone || owner != manager) { if (initializationDone || owner != manager) {
@ -462,6 +462,7 @@ public class LogManager {
private LoggerContext getUserContext() { private LoggerContext getUserContext() {
LoggerContext context = null; LoggerContext context = null;
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
JavaAWTAccess javaAwtAccess = SharedSecrets.getJavaAWTAccess(); JavaAWTAccess javaAwtAccess = SharedSecrets.getJavaAWTAccess();
if (sm != null && javaAwtAccess != null) { if (sm != null && javaAwtAccess != null) {
@ -551,6 +552,7 @@ public class LogManager {
return demandSystemLogger(name, resourceBundleName, module); return demandSystemLogger(name, resourceBundleName, module);
} }
@SuppressWarnings("removal")
Logger demandSystemLogger(String name, String resourceBundleName, Module module) { Logger demandSystemLogger(String name, String resourceBundleName, Module module) {
// Add a system logger in the system context's namespace // Add a system logger in the system context's namespace
final Logger sysLogger = getSystemContext() final Logger sysLogger = getSystemContext()
@ -853,6 +855,7 @@ public class LogManager {
// If logger.getUseParentHandlers() returns 'true' and any of the logger's // If logger.getUseParentHandlers() returns 'true' and any of the logger's
// parents have levels or handlers defined, make sure they are instantiated. // parents have levels or handlers defined, make sure they are instantiated.
@SuppressWarnings("removal")
private void processParentHandlers(final Logger logger, final String name, private void processParentHandlers(final Logger logger, final String name,
Predicate<Logger> visited) { Predicate<Logger> visited) {
final LogManager owner = getOwner(); final LogManager owner = getOwner();
@ -961,6 +964,7 @@ public class LogManager {
// We need to raise privilege here. All our decisions will // We need to raise privilege here. All our decisions will
// be made based on the logging configuration, which can // be made based on the logging configuration, which can
// only be modified by trusted code. // only be modified by trusted code.
@SuppressWarnings("removal")
private void loadLoggerHandlers(final Logger logger, final String name, private void loadLoggerHandlers(final Logger logger, final String name,
final String handlersPropertyName) final String handlersPropertyName)
{ {
@ -1226,6 +1230,7 @@ public class LogManager {
// Private method to set a level on a logger. // Private method to set a level on a logger.
// If necessary, we raise privilege before doing the call. // If necessary, we raise privilege before doing the call.
@SuppressWarnings("removal")
private static void doSetLevel(final Logger logger, final Level level) { private static void doSetLevel(final Logger logger, final Level level) {
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm == null) { if (sm == null) {
@ -1245,6 +1250,7 @@ public class LogManager {
// Private method to set a parent on a logger. // Private method to set a parent on a logger.
// If necessary, we raise privilege before doing the setParent call. // If necessary, we raise privilege before doing the setParent call.
@SuppressWarnings("removal")
private static void doSetParent(final Logger logger, final Logger parent) { private static void doSetParent(final Logger logger, final Logger parent) {
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm == null) { if (sm == null) {
@ -2428,6 +2434,7 @@ public class LogManager {
new LoggingPermission("control", null); new LoggingPermission("control", null);
void checkPermission() { void checkPermission() {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm != null) if (sm != null)
sm.checkPermission(controlPermission); sm.checkPermission(controlPermission);
@ -2613,11 +2620,14 @@ public class LogManager {
public LogManager addConfigurationListener(Runnable listener) { public LogManager addConfigurationListener(Runnable listener) {
final Runnable r = Objects.requireNonNull(listener); final Runnable r = Objects.requireNonNull(listener);
checkPermission(); checkPermission();
@SuppressWarnings("removal")
final SecurityManager sm = System.getSecurityManager(); final SecurityManager sm = System.getSecurityManager();
@SuppressWarnings("removal")
final AccessControlContext acc = final AccessControlContext acc =
sm == null ? null : AccessController.getContext(); sm == null ? null : AccessController.getContext();
final PrivilegedAction<Void> pa = final PrivilegedAction<Void> pa =
acc == null ? null : () -> { r.run() ; return null; }; acc == null ? null : () -> { r.run() ; return null; };
@SuppressWarnings("removal")
final Runnable pr = final Runnable pr =
acc == null ? r : () -> AccessController.doPrivileged(pa, acc); acc == null ? r : () -> AccessController.doPrivileged(pa, acc);
// Will do nothing if already registered. // Will do nothing if already registered.
@ -2710,6 +2720,7 @@ public class LogManager {
} }
Objects.requireNonNull(name); Objects.requireNonNull(name);
Objects.requireNonNull(module); Objects.requireNonNull(module);
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(controlPermission); sm.checkPermission(controlPermission);
@ -2732,6 +2743,11 @@ public class LogManager {
} }
static { static {
initStatic();
}
@SuppressWarnings("removal")
private static void initStatic() {
AccessController.doPrivileged(LoggingProviderAccess.INSTANCE, null, AccessController.doPrivileged(LoggingProviderAccess.INSTANCE, null,
controlPermission); controlPermission);
} }

View File

@ -119,7 +119,6 @@ import static java.lang.module.ModuleDescriptor.Modifier.SYNTHETIC;
* *
* @since 1.5 * @since 1.5
*/ */
@SuppressWarnings("removal")
public class RMIConnector implements JMXConnector, Serializable, JMXAddressable { public class RMIConnector implements JMXConnector, Serializable, JMXAddressable {
private static final ClassLogger logger = private static final ClassLogger logger =
@ -2066,7 +2065,9 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
Constructor<?> constr; Constructor<?> constr;
try { try {
stubClass = Class.forName(rmiConnectionImplStubClassName); stubClass = Class.forName(rmiConnectionImplStubClassName);
constr = (Constructor<?>) AccessController.doPrivileged(action); @SuppressWarnings("removal")
Constructor<?> tmp = (Constructor<?>) AccessController.doPrivileged(action);
constr = tmp;
} catch (Exception e) { } catch (Exception e) {
logger.error("<clinit>", logger.error("<clinit>",
"Failed to initialize proxy reference constructor "+ "Failed to initialize proxy reference constructor "+
@ -2210,6 +2211,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// Private stuff - Find / Set default class loader // Private stuff - Find / Set default class loader
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@SuppressWarnings("removal")
private ClassLoader pushDefaultClassLoader() { private ClassLoader pushDefaultClassLoader() {
final Thread t = Thread.currentThread(); final Thread t = Thread.currentThread();
final ClassLoader old = t.getContextClassLoader(); final ClassLoader old = t.getContextClassLoader();
@ -2223,6 +2225,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
return old; return old;
} }
@SuppressWarnings("removal")
private void popDefaultClassLoader(final ClassLoader old) { private void popDefaultClassLoader(final ClassLoader old) {
AccessController.doPrivileged(new PrivilegedAction<Void>() { AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() { public Void run() {

View File

@ -53,7 +53,6 @@ import java.util.concurrent.ConcurrentHashMap;
* Note: This class has to be public. It's loaded from the VM like this: * Note: This class has to be public. It's loaded from the VM like this:
* Class.forName(atName).newInstance(); * Class.forName(atName).newInstance();
*/ */
@SuppressWarnings("removal")
final public class AccessBridge { final public class AccessBridge {
private static AccessBridge theAccessBridge; private static AccessBridge theAccessBridge;
@ -83,6 +82,11 @@ final public class AccessBridge {
* Load DLLs * Load DLLs
*/ */
static { static {
initStatic();
}
@SuppressWarnings("removal")
private static void initStatic() {
// Load the appropriate DLLs // Load the appropriate DLLs
boolean is32on64 = false; boolean is32on64 = false;
if (System.getProperty("os.arch").equals("x86")) { if (System.getProperty("os.arch").equals("x86")) {

View File

@ -70,7 +70,6 @@ import static sun.security.pkcs11.wrapper.PKCS11Exception.*;
* @author Martin Schlaeffer <schlaeff@sbox.tugraz.at> * @author Martin Schlaeffer <schlaeff@sbox.tugraz.at>
* @invariants (pkcs11ModulePath_ <> null) * @invariants (pkcs11ModulePath_ <> null)
*/ */
@SuppressWarnings("removal")
public class PKCS11 { public class PKCS11 {
/** /**
@ -83,7 +82,8 @@ public class PKCS11 {
// cannot use LoadLibraryAction because that would make the native // cannot use LoadLibraryAction because that would make the native
// library available to the bootclassloader, but we run in the // library available to the bootclassloader, but we run in the
// extension classloader. // extension classloader.
AccessController.doPrivileged(new PrivilegedAction<Object>() { @SuppressWarnings("removal")
var dummy = AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() { public Object run() {
System.loadLibrary(PKCS11_WRAPPER); System.loadLibrary(PKCS11_WRAPPER);
return null; return null;