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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -66,7 +66,6 @@ import sun.swing.SwingUtilities2.RepaintListener;
* @author Arnaud Weber
* @since 1.2
*/
@SuppressWarnings("removal")
public class RepaintManager
{
/**
@ -212,15 +211,20 @@ public class RepaintManager
}
});
volatileImageBufferEnabled = "true".equals(AccessController.
@SuppressWarnings("removal")
var t1 = "true".equals(AccessController.
doPrivileged(new GetPropertyAction(
"swing.volatileImageBufferEnabled", "true")));
volatileImageBufferEnabled = t1;
boolean headless = GraphicsEnvironment.isHeadless();
if (volatileImageBufferEnabled && headless) {
volatileImageBufferEnabled = false;
}
nativeDoubleBuffering = "true".equals(AccessController.doPrivileged(
@SuppressWarnings("removal")
var t2 = "true".equals(AccessController.doPrivileged(
new GetPropertyAction("awt.nativeDoubleBuffering")));
nativeDoubleBuffering = t2;
@SuppressWarnings("removal")
String bs = AccessController.doPrivileged(
new GetPropertyAction("swing.bufferPerWindow"));
if (headless) {
@ -235,8 +239,10 @@ public class RepaintManager
else {
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")));
HANDLE_TOP_LEVEL_PAINT = t3;
GraphicsEnvironment ge = GraphicsEnvironment.
getLocalGraphicsEnvironment();
if (ge instanceof SunGraphicsEnvironment) {
@ -607,7 +613,9 @@ public class RepaintManager
}
runnableList.add(new Runnable() {
public void run() {
@SuppressWarnings("removal")
AccessControlContext stack = AccessController.getContext();
@SuppressWarnings("removal")
AccessControlContext acc =
AWTAccessor.getComponentAccessor().getAccessControlContext(c);
javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Void>() {
@ -738,7 +746,9 @@ public class RepaintManager
int n = ic.size();
for(int i = 0; i < n; i++) {
final Component c = ic.get(i);
@SuppressWarnings("removal")
AccessControlContext stack = AccessController.getContext();
@SuppressWarnings("removal")
AccessControlContext acc =
AWTAccessor.getComponentAccessor().getAccessControlContext(c);
javaSecurityAccess.doIntersectionPrivilege(
@ -844,7 +854,9 @@ public class RepaintManager
for (int j=0 ; j < count.get(); j++) {
final int i = j;
final Component dirtyComponent = roots.get(j);
@SuppressWarnings("removal")
AccessControlContext stack = AccessController.getContext();
@SuppressWarnings("removal")
AccessControlContext acc =
AWTAccessor.getComponentAccessor().getAccessControlContext(dirtyComponent);
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_ON;
@SuppressWarnings("removal")
public abstract class SunToolkit extends Toolkit
implements ComponentFactory, InputMethodSupport, KeyboardFocusManagerPeerProvider {
@ -121,6 +120,11 @@ public abstract class SunToolkit extends Toolkit
/* Load debug settings for native code */
static {
initStatic();
}
@SuppressWarnings("removal")
private static void initStatic() {
if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.nativedebug"))) {
DebugSettings.init();
}
@ -668,6 +672,7 @@ public abstract class SunToolkit extends Toolkit
* Returns the value of "sun.awt.noerasebackground" property. Default
* value is {@code false}.
*/
@SuppressWarnings("removal")
public static boolean getSunAwtNoerasebackground() {
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
* value is {@code false}.
*/
@SuppressWarnings("removal")
public static boolean getSunAwtErasebackgroundonresize() {
return AccessController.doPrivileged(new GetBooleanAction("sun.awt.erasebackgroundonresize"));
}
@ -895,6 +901,7 @@ public abstract class SunToolkit extends Toolkit
}
private static void checkPermissions(String filename) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(filename);
@ -902,6 +909,7 @@ public abstract class SunToolkit extends Toolkit
}
private static void checkPermissions(URL url) {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
try {
@ -1109,6 +1117,7 @@ public abstract class SunToolkit extends Toolkit
public boolean canPopupOverlapTaskBar() {
boolean result = true;
try {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
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.
*/
@SuppressWarnings("removal")
public static Locale getStartupLocale() {
if (startupLocale == null) {
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
*/
public static boolean needsXEmbed() {
@SuppressWarnings("removal")
String noxembed = AccessController.
doPrivileged(new GetPropertyAction("sun.awt.noxembed", "false"));
if ("true".equals(noxembed)) {
@ -1225,6 +1236,7 @@ public abstract class SunToolkit extends Toolkit
* developer. If true, Toolkit should return an
* XEmbed-server-enabled CanvasPeer instead of the ordinary CanvasPeer.
*/
@SuppressWarnings("removal")
protected final boolean isXEmbedServerRequested() {
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
* this method will return "true" the toolkit will return a null map.
*/
@SuppressWarnings("removal")
private static boolean useSystemAAFontSettings() {
if (!checkedSystemAAFontSettings) {
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
* value is {@code false}.
*/
@SuppressWarnings("removal")
public static synchronized boolean getSunAwtDisableMixing() {
if (sunAwtDisableMixing == null) {
sunAwtDisableMixing = AccessController.doPrivileged(

View File

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

View File

@ -104,7 +104,6 @@ import javax.print.attribute.standard.Media;
*
* @author Richard Blanchard
*/
@SuppressWarnings("removal")
public class PSPrinterJob extends RasterPrinterJob {
/* Class Constants */
@ -335,6 +334,11 @@ public class PSPrinterJob extends RasterPrinterJob {
/* Class static initialiser block */
static {
initStatic();
}
@SuppressWarnings("removal")
private static void initStatic() {
//enable priviledges so initProps can access system properties,
// open the property file, etc.
java.security.AccessController.doPrivileged(
@ -504,6 +508,7 @@ public class PSPrinterJob extends RasterPrinterJob {
* this method is called to mark the start of a
* document.
*/
@SuppressWarnings("removal")
protected void startDoc() throws PrinterException {
// A security check has been performed in the
@ -758,6 +763,7 @@ public class PSPrinterJob extends RasterPrinterJob {
/**
* Invoked if the application cancelled the printjob.
*/
@SuppressWarnings("removal")
protected void abortDoc() {
if (mPSStream != null && mDestType != RasterPrinterJob.STREAM) {
mPSStream.close();
@ -779,6 +785,7 @@ public class PSPrinterJob extends RasterPrinterJob {
* this method is called after that last page
* has been imaged.
*/
@SuppressWarnings("removal")
protected void endDoc() throws PrinterException {
if (mPSStream != null) {
mPSStream.println(EOF_COMMENT);
@ -848,6 +855,7 @@ public class PSPrinterJob extends RasterPrinterJob {
paperWidth + " " + paperHeight + "]");
final PrintService pservice = getPrintService();
@SuppressWarnings("removal")
Boolean isPS = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Boolean>() {
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.
// ie. Take a look at RadioButtonBorder, etc...
@SuppressWarnings("removal")
protected void initComponentDefaults(UIDefaults table)
{
super.initComponentDefaults( table );
@ -594,16 +593,19 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
if (!(this instanceof WindowsClassicLookAndFeel) &&
(OSInfo.getOSType() == OSInfo.OSType.WINDOWS &&
OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_XP) >= 0) &&
AccessController.doPrivileged(new GetPropertyAction("swing.noxp")) == null) {
(OSInfo.getOSType() == OSInfo.OSType.WINDOWS &&
OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_XP) >= 0)) {
@SuppressWarnings("removal")
String prop = AccessController.doPrivileged(new GetPropertyAction("swing.noxp"));
if (prop == null) {
// These desktop properties are not used directly, but are needed to
// trigger realoading of UI's.
this.themeActive = new TriggerDesktopProperty("win.xpstyle.themeActive");
this.dllName = new TriggerDesktopProperty("win.xpstyle.dllName");
this.colorName = new TriggerDesktopProperty("win.xpstyle.colorName");
this.sizeName = new TriggerDesktopProperty("win.xpstyle.sizeName");
// These desktop properties are not used directly, but are needed to
// trigger realoading of UI's.
this.themeActive = new TriggerDesktopProperty("win.xpstyle.themeActive");
this.dllName = new TriggerDesktopProperty("win.xpstyle.dllName");
this.colorName = new TriggerDesktopProperty("win.xpstyle.colorName");
this.sizeName = new TriggerDesktopProperty("win.xpstyle.sizeName");
}
}

View File

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

View File

@ -119,7 +119,6 @@ import static java.lang.module.ModuleDescriptor.Modifier.SYNTHETIC;
*
* @since 1.5
*/
@SuppressWarnings("removal")
public class RMIConnector implements JMXConnector, Serializable, JMXAddressable {
private static final ClassLogger logger =
@ -2066,7 +2065,9 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
Constructor<?> constr;
try {
stubClass = Class.forName(rmiConnectionImplStubClassName);
constr = (Constructor<?>) AccessController.doPrivileged(action);
@SuppressWarnings("removal")
Constructor<?> tmp = (Constructor<?>) AccessController.doPrivileged(action);
constr = tmp;
} catch (Exception e) {
logger.error("<clinit>",
"Failed to initialize proxy reference constructor "+
@ -2210,6 +2211,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
//--------------------------------------------------------------------
// Private stuff - Find / Set default class loader
//--------------------------------------------------------------------
@SuppressWarnings("removal")
private ClassLoader pushDefaultClassLoader() {
final Thread t = Thread.currentThread();
final ClassLoader old = t.getContextClassLoader();
@ -2223,6 +2225,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
return old;
}
@SuppressWarnings("removal")
private void popDefaultClassLoader(final ClassLoader old) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
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:
* Class.forName(atName).newInstance();
*/
@SuppressWarnings("removal")
final public class AccessBridge {
private static AccessBridge theAccessBridge;
@ -83,6 +82,11 @@ final public class AccessBridge {
* Load DLLs
*/
static {
initStatic();
}
@SuppressWarnings("removal")
private static void initStatic() {
// Load the appropriate DLLs
boolean is32on64 = false;
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>
* @invariants (pkcs11ModulePath_ <> null)
*/
@SuppressWarnings("removal")
public class PKCS11 {
/**
@ -83,7 +82,8 @@ public class PKCS11 {
// cannot use LoadLibraryAction because that would make the native
// library available to the bootclassloader, but we run in the
// extension classloader.
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@SuppressWarnings("removal")
var dummy = AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
System.loadLibrary(PKCS11_WRAPPER);
return null;