Skip to content

Commit 508cec7

Browse files
committed
8267521: Post JEP 411 refactoring: maximum covering > 50K
Reviewed-by: dfuchs, prr
1 parent 40d23a0 commit 508cec7

File tree

18 files changed

+206
-105
lines changed

18 files changed

+206
-105
lines changed

src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@
178178
* @since 1.7
179179
* @author Doug Lea
180180
*/
181-
@SuppressWarnings("removal")
182181
public class ForkJoinPool extends AbstractExecutorService {
183182

184183
/*
@@ -751,11 +750,13 @@ public class ForkJoinPool extends AbstractExecutorService {
751750
* permission to modify threads.
752751
*/
753752
private static void checkPermission() {
753+
@SuppressWarnings("removal")
754754
SecurityManager security = System.getSecurityManager();
755755
if (security != null)
756756
security.checkPermission(modifyThreadPermission);
757757
}
758758

759+
@SuppressWarnings("removal")
759760
static AccessControlContext contextWithPermissions(Permission ... perms) {
760761
Permissions permissions = new Permissions();
761762
for (Permission perm : perms)
@@ -799,9 +800,11 @@ public static interface ForkJoinWorkerThreadFactory {
799800
static final class DefaultForkJoinWorkerThreadFactory
800801
implements ForkJoinWorkerThreadFactory {
801802
// ACC for access to the factory
803+
@SuppressWarnings("removal")
802804
private static final AccessControlContext ACC = contextWithPermissions(
803805
new RuntimePermission("getClassLoader"),
804806
new RuntimePermission("setContextClassLoader"));
807+
@SuppressWarnings("removal")
805808
public final ForkJoinWorkerThread newThread(ForkJoinPool pool) {
806809
return AccessController.doPrivileged(
807810
new PrivilegedAction<>() {
@@ -821,13 +824,15 @@ public ForkJoinWorkerThread run() {
821824
*/
822825
static final class DefaultCommonPoolForkJoinWorkerThreadFactory
823826
implements ForkJoinWorkerThreadFactory {
827+
@SuppressWarnings("removal")
824828
private static final AccessControlContext ACC = contextWithPermissions(
825829
modifyThreadPermission,
826830
new RuntimePermission("enableContextClassLoaderOverride"),
827831
new RuntimePermission("modifyThreadGroup"),
828832
new RuntimePermission("getClassLoader"),
829833
new RuntimePermission("setContextClassLoader"));
830834

835+
@SuppressWarnings("removal")
831836
public final ForkJoinWorkerThread newThread(ForkJoinPool pool) {
832837
return AccessController.doPrivileged(
833838
new PrivilegedAction<>() {
@@ -1253,11 +1258,13 @@ final void helpAsyncBlocker(ManagedBlocker blocker) {
12531258
// misc
12541259

12551260
/** AccessControlContext for innocuous workers, created on 1st use. */
1261+
@SuppressWarnings("removal")
12561262
private static AccessControlContext INNOCUOUS_ACC;
12571263

12581264
/**
12591265
* Initializes (upon registration) InnocuousForkJoinWorkerThreads.
12601266
*/
1267+
@SuppressWarnings("removal")
12611268
final void initializeInnocuousWorker() {
12621269
AccessControlContext acc; // racy construction OK
12631270
if ((acc = INNOCUOUS_ACC) == null)
@@ -3497,9 +3504,11 @@ protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable) {
34973504
defaultForkJoinWorkerThreadFactory =
34983505
new DefaultForkJoinWorkerThreadFactory();
34993506
modifyThreadPermission = new RuntimePermission("modifyThread");
3500-
common = AccessController.doPrivileged(new PrivilegedAction<>() {
3507+
@SuppressWarnings("removal")
3508+
ForkJoinPool tmp = AccessController.doPrivileged(new PrivilegedAction<>() {
35013509
public ForkJoinPool run() {
35023510
return new ForkJoinPool((byte)0); }});
3511+
common = tmp;
35033512

35043513
COMMON_PARALLELISM = Math.max(common.mode & SMASK, 1);
35053514
}

src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import sun.util.logging.PlatformLogger;
4949

5050

51-
@SuppressWarnings("removal")
5251
public class FtpClient extends sun.net.ftp.FtpClient {
5352

5453
private static int defaultSoTimeout;
@@ -111,16 +110,13 @@ public class FtpClient extends sun.net.ftp.FtpClient {
111110

112111
static {
113112
final int vals[] = {0, 0};
114-
final String encs[] = {null};
115-
116-
AccessController.doPrivileged(
117-
new PrivilegedAction<Object>() {
118-
119-
public Object run() {
113+
@SuppressWarnings("removal")
114+
final String enc = AccessController.doPrivileged(
115+
new PrivilegedAction<String>() {
116+
public String run() {
120117
vals[0] = Integer.getInteger("sun.net.client.defaultReadTimeout", 300_000).intValue();
121118
vals[1] = Integer.getInteger("sun.net.client.defaultConnectTimeout", 300_000).intValue();
122-
encs[0] = System.getProperty("file.encoding", "ISO8859_1");
123-
return null;
119+
return System.getProperty("file.encoding", "ISO8859_1");
124120
}
125121
});
126122
if (vals[0] == 0) {
@@ -135,7 +131,7 @@ public Object run() {
135131
defaultConnectTimeout = vals[1];
136132
}
137133

138-
encoding = encs[0];
134+
encoding = enc;
139135
try {
140136
if (!isASCIISuperset(encoding)) {
141137
encoding = "ISO8859_1";
@@ -632,27 +628,20 @@ private Socket openPassiveDataConnection(String cmd) throws sun.net.ftp.FtpProto
632628
Socket s;
633629
if (proxy != null) {
634630
if (proxy.type() == Proxy.Type.SOCKS) {
635-
s = AccessController.doPrivileged(
636-
new PrivilegedAction<Socket>() {
637-
638-
public Socket run() {
639-
return new Socket(proxy);
640-
}
641-
});
631+
PrivilegedAction<Socket> pa = () -> new Socket(proxy);
632+
@SuppressWarnings("removal")
633+
var tmp = AccessController.doPrivileged(pa);
634+
s = tmp;
642635
} else {
643636
s = new Socket(Proxy.NO_PROXY);
644637
}
645638
} else {
646639
s = new Socket();
647640
}
648641

649-
InetAddress serverAddress = AccessController.doPrivileged(
650-
new PrivilegedAction<InetAddress>() {
651-
@Override
652-
public InetAddress run() {
653-
return server.getLocalAddress();
654-
}
655-
});
642+
PrivilegedAction<InetAddress> pa = () -> server.getLocalAddress();
643+
@SuppressWarnings("removal")
644+
InetAddress serverAddress = AccessController.doPrivileged(pa);
656645

657646
// Bind the socket to the same address as the control channel. This
658647
// is needed in case of multi-homed systems.
@@ -925,13 +914,10 @@ private Socket doConnect(InetSocketAddress dest, int timeout) throws IOException
925914
Socket s;
926915
if (proxy != null) {
927916
if (proxy.type() == Proxy.Type.SOCKS) {
928-
s = AccessController.doPrivileged(
929-
new PrivilegedAction<Socket>() {
930-
931-
public Socket run() {
932-
return new Socket(proxy);
933-
}
934-
});
917+
PrivilegedAction<Socket> pa = () -> new Socket(proxy);
918+
@SuppressWarnings("removal")
919+
var tmp = AccessController.doPrivileged(pa);
920+
s = tmp;
935921
} else {
936922
s = new Socket(Proxy.NO_PROXY);
937923
}

src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
import sun.java2d.Disposer;
6060
import sun.java2d.DisposerRecord;
6161

62-
@SuppressWarnings("removal")
6362
public class JPEGImageReader extends ImageReader {
6463

6564
private boolean debug = false;
@@ -87,6 +86,11 @@ public class JPEGImageReader extends ImageReader {
8786
private int numImages = 0;
8887

8988
static {
89+
initStatic();
90+
}
91+
92+
@SuppressWarnings("removal")
93+
private static void initStatic() {
9094
java.security.AccessController.doPrivileged(
9195
new java.security.PrivilegedAction<Void>() {
9296
@Override

src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
import sun.java2d.Disposer;
6464
import sun.java2d.DisposerRecord;
6565

66-
@SuppressWarnings("removal")
6766
public class JPEGImageWriter extends ImageWriter {
6867

6968
///////// Private variables
@@ -173,6 +172,11 @@ public class JPEGImageWriter extends ImageWriter {
173172
///////// static initializer
174173

175174
static {
175+
initStatic();
176+
}
177+
178+
@SuppressWarnings("removal")
179+
private static void initStatic() {
176180
java.security.AccessController.doPrivileged(
177181
new java.security.PrivilegedAction<Void>() {
178182
@Override

src/java.desktop/share/classes/java/awt/Component.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@
214214
* @author Arthur van Hoff
215215
* @author Sami Shaio
216216
*/
217-
@SuppressWarnings("removal")
218217
public abstract class Component implements ImageObserver, MenuContainer,
219218
Serializable
220219
{
@@ -506,6 +505,7 @@ static class AWTTreeLock {}
506505
/*
507506
* The component's AccessControlContext.
508507
*/
508+
@SuppressWarnings("removal")
509509
private transient volatile AccessControlContext acc =
510510
AccessController.getContext();
511511

@@ -627,13 +627,15 @@ static class AWTTreeLock {}
627627
initIDs();
628628
}
629629

630+
@SuppressWarnings("removal")
630631
String s = java.security.AccessController.doPrivileged(
631632
new GetPropertyAction("awt.image.incrementaldraw"));
632633
isInc = (s == null || s.equals("true"));
633634

634-
s = java.security.AccessController.doPrivileged(
635+
@SuppressWarnings("removal")
636+
String s2 = java.security.AccessController.doPrivileged(
635637
new GetPropertyAction("awt.image.redrawrate"));
636-
incRate = (s != null) ? Integer.parseInt(s) : 100;
638+
incRate = (s2 != null) ? Integer.parseInt(s2) : 100;
637639
}
638640

639641
/**
@@ -712,6 +714,7 @@ Object getObjectLock() {
712714
/*
713715
* Returns the acc this component was constructed with.
714716
*/
717+
@SuppressWarnings("removal")
715718
final AccessControlContext getAccessControlContext() {
716719
if (acc == null) {
717720
throw new SecurityException("Component is missing AccessControlContext");
@@ -974,6 +977,7 @@ public void processEvent(Component comp, AWTEvent e) {
974977
comp.processEvent(e);
975978
}
976979

980+
@SuppressWarnings("removal")
977981
public AccessControlContext getAccessControlContext(Component comp) {
978982
return comp.getAccessControlContext();
979983
}
@@ -1427,6 +1431,7 @@ public Point getMousePosition() throws HeadlessException {
14271431
throw new HeadlessException();
14281432
}
14291433

1434+
@SuppressWarnings("removal")
14301435
PointerInfo pi = java.security.AccessController.doPrivileged(
14311436
new java.security.PrivilegedAction<PointerInfo>() {
14321437
public PointerInfo run() {
@@ -6253,6 +6258,7 @@ private boolean checkCoalescing() {
62536258
}
62546259

62556260
// Need to check non-bootstraps.
6261+
@SuppressWarnings("removal")
62566262
Boolean enabled = java.security.AccessController.doPrivileged(
62576263
new java.security.PrivilegedAction<Boolean>() {
62586264
public Boolean run() {
@@ -8988,6 +8994,7 @@ private void writeObject(ObjectOutputStream s)
89888994
* @throws IOException if an I/O error occurs
89898995
* @see #writeObject(ObjectOutputStream)
89908996
*/
8997+
@SuppressWarnings("removal")
89918998
@Serial
89928999
private void readObject(ObjectInputStream s)
89939000
throws ClassNotFoundException, IOException

src/java.desktop/share/classes/java/awt/Container.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@
9494
* @see LayoutManager
9595
* @since 1.0
9696
*/
97-
@SuppressWarnings("removal")
9897
public class Container extends Component {
9998

10099
private static final PlatformLogger log = PlatformLogger.getLogger("java.awt.Container");
@@ -1576,12 +1575,11 @@ public boolean isValidateRoot() {
15761575
return false;
15771576
}
15781577

1579-
private static final boolean isJavaAwtSmartInvalidate;
1580-
static {
1581-
// Don't lazy-read because every app uses invalidate()
1582-
isJavaAwtSmartInvalidate = AccessController.doPrivileged(
1578+
// Don't lazy-read because every app uses invalidate()
1579+
@SuppressWarnings("removal")
1580+
private static final boolean isJavaAwtSmartInvalidate
1581+
= AccessController.doPrivileged(
15831582
new GetBooleanAction("java.awt.smartInvalidate"));
1584-
}
15851583

15861584
/**
15871585
* Invalidates the parent of the container unless the container
@@ -2634,6 +2632,7 @@ public Point getMousePosition(boolean allowChildren) throws HeadlessException {
26342632
if (GraphicsEnvironment.isHeadless()) {
26352633
throw new HeadlessException();
26362634
}
2635+
@SuppressWarnings("removal")
26372636
PointerInfo pi = java.security.AccessController.doPrivileged(
26382637
new java.security.PrivilegedAction<PointerInfo>() {
26392638
public PointerInfo run() {

src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
* @see Component#getFocusTraversalKeys
6565
* @since 1.4
6666
*/
67-
@SuppressWarnings("removal")
6867
public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
6968
private static final PlatformLogger focusLog = PlatformLogger.getLogger("java.awt.focus.DefaultKeyboardFocusManager");
7069

@@ -84,6 +83,11 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
8483
private static boolean fxAppThreadIsDispatchThread;
8584

8685
static {
86+
initStatic();
87+
}
88+
89+
@SuppressWarnings("removal")
90+
private static void initStatic() {
8791
AWTAccessor.setDefaultKeyboardFocusManagerAccessor(
8892
new AWTAccessor.DefaultKeyboardFocusManagerAccessor() {
8993
public void consumeNextKeyTyped(DefaultKeyboardFocusManager dkfm, KeyEvent e) {

0 commit comments

Comments
 (0)