Skip to content

Commit c81a722

Browse files
8264139: Suppress removal warnings for Security Manager methods
Co-authored-by: Weijun Wang <weijun@openjdk.org> Co-authored-by: Kevin Rushforth <kcr@openjdk.org> Reviewed-by: aghaisas, arapte
1 parent 0ffa8e2 commit c81a722

File tree

194 files changed

+586
-144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+586
-144
lines changed

modules/javafx.base/src/main/java/com/sun/javafx/PlatformUtil.java

+23-7
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,28 @@ public class PlatformUtil {
5252
private static String javafxPlatform;
5353

5454
static {
55-
javafxPlatform = AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty("javafx.platform"));
55+
@SuppressWarnings("removal")
56+
String str1 = AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty("javafx.platform"));
57+
javafxPlatform = str1;
58+
5659
loadProperties();
57-
embedded = AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> Boolean.getBoolean("com.sun.javafx.isEmbedded"));
58-
embeddedType = AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty("embedded"));
59-
useEGL = AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> Boolean.getBoolean("use.egl"));
60+
61+
@SuppressWarnings("removal")
62+
boolean bool1 = AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> Boolean.getBoolean("com.sun.javafx.isEmbedded"));
63+
embedded = bool1;
64+
65+
@SuppressWarnings("removal")
66+
String str2 = AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty("embedded"));
67+
embeddedType = str2;
68+
69+
@SuppressWarnings("removal")
70+
boolean bool2 = AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> Boolean.getBoolean("use.egl"));
71+
useEGL = bool2;
72+
6073
if (useEGL) {
61-
doEGLCompositing = AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> Boolean.getBoolean("doNativeComposite"));
74+
@SuppressWarnings("removal")
75+
boolean bool3 = AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> Boolean.getBoolean("doNativeComposite"));
76+
doEGLCompositing = bool3;
6277
} else
6378
doEGLCompositing = false;
6479
}
@@ -134,8 +149,8 @@ public static boolean useEGLWindowComposition() {
134149
}
135150

136151
public static boolean useGLES2() {
137-
String useGles2 = "false";
138-
useGles2 =
152+
@SuppressWarnings("removal")
153+
String useGles2 =
139154
AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty("use.gles2"));
140155
if ("true".equals(useGles2))
141156
return true;
@@ -244,6 +259,7 @@ private static File getRTDir() {
244259
}
245260
}
246261

262+
@SuppressWarnings("removal")
247263
private static void loadProperties() {
248264
final String vmname = System.getProperty("java.vm.name");
249265
final String arch = System.getProperty("os.arch");

modules/javafx.base/src/main/java/com/sun/javafx/logging/PrintLogger.java

+2
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@ class PrintLogger extends Logger {
5454
* the threshold, then it is logged, otherwise an abbreviated representation including
5555
* only the time of the pulse is logged.
5656
*/
57+
@SuppressWarnings("removal")
5758
private static long THRESHOLD = (long)
5859
AccessController.doPrivileged((PrivilegedAction<Integer>) () -> Integer.getInteger("javafx.pulseLogger.threshold", 17));
5960

6061
/**
6162
* Optionally exit after a given number of pulses
6263
*/
64+
@SuppressWarnings("removal")
6365
private static final int EXIT_ON_PULSE =
6466
AccessController.doPrivileged((PrivilegedAction<Integer>) () -> Integer.getInteger("javafx.pulseLogger.exitOnPulse", 0));
6567

modules/javafx.base/src/main/java/com/sun/javafx/logging/PulseLogger.java

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public static void newInput(String name) {
102102
* @return true if the user requested pulse logging by setting the system
103103
* property javafx.pulseLogger to true, false otherwise.
104104
*/
105+
@SuppressWarnings("removal")
105106
public static boolean isPulseLoggingRequested() {
106107
return AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> Boolean.getBoolean("javafx.pulseLogger"));
107108
}

modules/javafx.base/src/main/java/com/sun/javafx/property/MethodHelper.java

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
* Utility class to wrap method invocation.
3737
*/
3838
public class MethodHelper {
39+
@SuppressWarnings("removal")
3940
private static final boolean logAccessErrors
4041
= AccessController.doPrivileged((PrivilegedAction<Boolean>) ()
4142
-> Boolean.getBoolean("sun.reflect.debugModuleAccessChecks"));

modules/javafx.base/src/main/java/com/sun/javafx/property/PropertyReference.java

-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@
2525

2626
package com.sun.javafx.property;
2727

28-
import static java.security.AccessController.doPrivileged;
29-
3028
import java.lang.reflect.Method;
3129
import java.lang.reflect.Modifier;
32-
import java.security.PrivilegedAction;
3330

3431
import javafx.beans.property.ReadOnlyProperty;
3532

modules/javafx.base/src/main/java/com/sun/javafx/property/adapter/Disposer.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public class Disposer implements Runnable {
5050
static {
5151
disposerInstance = new Disposer();
5252

53-
java.security.AccessController.doPrivileged(
53+
@SuppressWarnings("removal")
54+
var dummy = java.security.AccessController.doPrivileged(
5455
new java.security.PrivilegedAction() {
5556
public Object run() {
5657
/* The thread must be a member of a thread group

modules/javafx.base/src/main/java/com/sun/javafx/reflect/MethodUtil.java

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class Trampoline {
5858
}
5959
}
6060

61+
@SuppressWarnings("removal")
6162
private static void ensureInvocableMethod(Method m)
6263
throws InvocationTargetException
6364
{
@@ -107,6 +108,7 @@ public static Method[] getMethods(Class<?> cls) {
107108
* we're done.
108109
*/
109110
/*public*/
111+
@SuppressWarnings("removal")
110112
static Method[] getPublicMethods(Class<?> cls) {
111113
// compatibility for update release
112114
if (System.getSecurityManager() == null) {
@@ -291,6 +293,7 @@ public static Object invoke(Method m, Object obj, Object[] params)
291293
}
292294
}
293295

296+
@SuppressWarnings("removal")
294297
private static Method getTrampoline() {
295298
try {
296299
return AccessController.doPrivileged(

modules/javafx.base/src/main/java/com/sun/javafx/reflect/ReflectUtil.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ private ReflectUtil() {
4141
* also check the package access on the proxy interfaces.
4242
*/
4343
public static void checkPackageAccess(Class<?> clazz) {
44+
@SuppressWarnings("removal")
4445
SecurityManager s = System.getSecurityManager();
4546
if (s != null) {
4647
privateCheckPackageAccess(s, clazz);
@@ -50,7 +51,7 @@ public static void checkPackageAccess(Class<?> clazz) {
5051
/**
5152
* NOTE: should only be called if a SecurityManager is installed
5253
*/
53-
private static void privateCheckPackageAccess(SecurityManager s, Class<?> clazz) {
54+
private static void privateCheckPackageAccess(@SuppressWarnings("removal") SecurityManager s, Class<?> clazz) {
5455
while (clazz.isArray()) {
5556
clazz = clazz.getComponentType();
5657
}
@@ -72,6 +73,7 @@ private static void privateCheckPackageAccess(SecurityManager s, Class<?> clazz)
7273
* the true caller (application).
7374
*/
7475
public static void checkPackageAccess(String name) {
76+
@SuppressWarnings("removal")
7577
SecurityManager s = System.getSecurityManager();
7678
if (s != null) {
7779
String cname = name.replace('/', '.');
@@ -100,7 +102,7 @@ public static boolean isPackageAccessible(Class<?> clazz) {
100102
/**
101103
* NOTE: should only be called if a SecurityManager is installed
102104
*/
103-
private static void privateCheckProxyPackageAccess(SecurityManager s, Class<?> clazz) {
105+
private static void privateCheckProxyPackageAccess(@SuppressWarnings("removal") SecurityManager s, Class<?> clazz) {
104106
// check proxy interfaces if the given class is a proxy class
105107
if (Proxy.isProxyClass(clazz)) {
106108
for (Class<?> intf : clazz.getInterfaces()) {

modules/javafx.base/src/main/java/javafx/beans/property/adapter/JavaBeanBooleanProperty.java

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public final class JavaBeanBooleanProperty extends BooleanProperty implements Ja
9696
private ObservableValue<? extends Boolean> observable = null;
9797
private ExpressionHelper<Boolean> helper = null;
9898

99+
@SuppressWarnings("removal")
99100
private final AccessControlContext acc = AccessController.getContext();
100101

101102
JavaBeanBooleanProperty(PropertyDescriptor descriptor, Object bean) {
@@ -112,6 +113,7 @@ public final class JavaBeanBooleanProperty extends BooleanProperty implements Ja
112113
* property throws an {@code IllegalAccessException} or an
113114
* {@code InvocationTargetException}.
114115
*/
116+
@SuppressWarnings("removal")
115117
@Override
116118
public boolean get() {
117119
return AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> {
@@ -132,6 +134,7 @@ public boolean get() {
132134
* property throws an {@code IllegalAccessException} or an
133135
* {@code InvocationTargetException}.
134136
*/
137+
@SuppressWarnings("removal")
135138
@Override
136139
public void set(final boolean value) {
137140
if (isBound()) {

modules/javafx.base/src/main/java/javafx/beans/property/adapter/JavaBeanDoubleProperty.java

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public final class JavaBeanDoubleProperty extends DoubleProperty implements Java
9696
private ObservableValue<? extends Number> observable = null;
9797
private ExpressionHelper<Number> helper = null;
9898

99+
@SuppressWarnings("removal")
99100
private final AccessControlContext acc = AccessController.getContext();
100101

101102
JavaBeanDoubleProperty(PropertyDescriptor descriptor, Object bean) {
@@ -112,6 +113,7 @@ public final class JavaBeanDoubleProperty extends DoubleProperty implements Java
112113
* property throws an {@code IllegalAccessException} or an
113114
* {@code InvocationTargetException}.
114115
*/
116+
@SuppressWarnings("removal")
115117
@Override
116118
public double get() {
117119
return AccessController.doPrivileged((PrivilegedAction<Double>) () -> {
@@ -133,6 +135,7 @@ public double get() {
133135
* property throws an {@code IllegalAccessException} or an
134136
* {@code InvocationTargetException}.
135137
*/
138+
@SuppressWarnings("removal")
136139
@Override
137140
public void set(final double value) {
138141
if (isBound()) {

modules/javafx.base/src/main/java/javafx/beans/property/adapter/JavaBeanFloatProperty.java

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public final class JavaBeanFloatProperty extends FloatProperty implements JavaBe
9696
private ObservableValue<? extends Number> observable = null;
9797
private ExpressionHelper<Number> helper = null;
9898

99+
@SuppressWarnings("removal")
99100
private final AccessControlContext acc = AccessController.getContext();
100101

101102
JavaBeanFloatProperty(PropertyDescriptor descriptor, Object bean) {
@@ -112,6 +113,7 @@ public final class JavaBeanFloatProperty extends FloatProperty implements JavaBe
112113
* property throws an {@code IllegalAccessException} or an
113114
* {@code InvocationTargetException}.
114115
*/
116+
@SuppressWarnings("removal")
115117
@Override
116118
public float get() {
117119
return AccessController.doPrivileged((PrivilegedAction<Float>) () -> {
@@ -133,6 +135,7 @@ public float get() {
133135
* property throws an {@code IllegalAccessException} or an
134136
* {@code InvocationTargetException}.
135137
*/
138+
@SuppressWarnings("removal")
136139
@Override
137140
public void set(final float value) {
138141
if (isBound()) {

modules/javafx.base/src/main/java/javafx/beans/property/adapter/JavaBeanIntegerProperty.java

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public final class JavaBeanIntegerProperty extends IntegerProperty implements Ja
9696
private ObservableValue<? extends Number> observable = null;
9797
private ExpressionHelper<Number> helper = null;
9898

99+
@SuppressWarnings("removal")
99100
private final AccessControlContext acc = AccessController.getContext();
100101

101102
JavaBeanIntegerProperty(PropertyDescriptor descriptor, Object bean) {
@@ -112,6 +113,7 @@ public final class JavaBeanIntegerProperty extends IntegerProperty implements Ja
112113
* property throws an {@code IllegalAccessException} or an
113114
* {@code InvocationTargetException}.
114115
*/
116+
@SuppressWarnings("removal")
115117
@Override
116118
public int get() {
117119
return AccessController.doPrivileged((PrivilegedAction<Integer>) () -> {
@@ -133,6 +135,7 @@ public int get() {
133135
* property throws an {@code IllegalAccessException} or an
134136
* {@code InvocationTargetException}.
135137
*/
138+
@SuppressWarnings("removal")
136139
@Override
137140
public void set(final int value) {
138141
if (isBound()) {

modules/javafx.base/src/main/java/javafx/beans/property/adapter/JavaBeanLongProperty.java

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public final class JavaBeanLongProperty extends LongProperty implements JavaBean
9696
private ObservableValue<? extends Number> observable = null;
9797
private ExpressionHelper<Number> helper = null;
9898

99+
@SuppressWarnings("removal")
99100
private final AccessControlContext acc = AccessController.getContext();
100101

101102
JavaBeanLongProperty(PropertyDescriptor descriptor, Object bean) {
@@ -112,6 +113,7 @@ public final class JavaBeanLongProperty extends LongProperty implements JavaBean
112113
* property throws an {@code IllegalAccessException} or an
113114
* {@code InvocationTargetException}.
114115
*/
116+
@SuppressWarnings("removal")
115117
@Override
116118
public long get() {
117119
return AccessController.doPrivileged((PrivilegedAction<Long>) () -> {
@@ -133,6 +135,7 @@ public long get() {
133135
* property throws an {@code IllegalAccessException} or an
134136
* {@code InvocationTargetException}.
135137
*/
138+
@SuppressWarnings("removal")
136139
@Override
137140
public void set(final long value) {
138141
if (isBound()) {

modules/javafx.base/src/main/java/javafx/beans/property/adapter/JavaBeanObjectProperty.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public final class JavaBeanObjectProperty<T> extends ObjectProperty<T> implement
9898
private ObservableValue<? extends T> observable = null;
9999
private ExpressionHelper<T> helper = null;
100100

101+
@SuppressWarnings("removal")
101102
private final AccessControlContext acc = AccessController.getContext();
102103

103104
JavaBeanObjectProperty(PropertyDescriptor descriptor, Object bean) {
@@ -114,7 +115,7 @@ public final class JavaBeanObjectProperty<T> extends ObjectProperty<T> implement
114115
* property throws an {@code IllegalAccessException} or an
115116
* {@code InvocationTargetException}.
116117
*/
117-
@SuppressWarnings("unchecked")
118+
@SuppressWarnings({"removal","unchecked"})
118119
@Override
119120
public T get() {
120121
return AccessController.doPrivileged((PrivilegedAction<T>) () -> {
@@ -135,6 +136,7 @@ public T get() {
135136
* property throws an {@code IllegalAccessException} or an
136137
* {@code InvocationTargetException}.
137138
*/
139+
@SuppressWarnings("removal")
138140
@Override
139141
public void set(final T value) {
140142
if (isBound()) {

modules/javafx.base/src/main/java/javafx/beans/property/adapter/JavaBeanStringProperty.java

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public final class JavaBeanStringProperty extends StringProperty implements Java
9696
private ObservableValue<? extends String> observable = null;
9797
private ExpressionHelper<String> helper = null;
9898

99+
@SuppressWarnings("removal")
99100
private final AccessControlContext acc = AccessController.getContext();
100101

101102
JavaBeanStringProperty(PropertyDescriptor descriptor, Object bean) {
@@ -112,6 +113,7 @@ public final class JavaBeanStringProperty extends StringProperty implements Java
112113
* property throws an {@code IllegalAccessException} or an
113114
* {@code InvocationTargetException}.
114115
*/
116+
@SuppressWarnings("removal")
115117
@Override
116118
public String get() {
117119
return AccessController.doPrivileged((PrivilegedAction<String>) () -> {
@@ -132,6 +134,7 @@ public String get() {
132134
* property throws an {@code IllegalAccessException} or an
133135
* {@code InvocationTargetException}.
134136
*/
137+
@SuppressWarnings("removal")
135138
@Override
136139
public void set(final String value) {
137140
if (isBound()) {

modules/javafx.base/src/main/java/javafx/beans/property/adapter/ReadOnlyJavaBeanBooleanProperty.java

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public final class ReadOnlyJavaBeanBooleanProperty extends ReadOnlyBooleanProper
8585
private final ReadOnlyPropertyDescriptor descriptor;
8686
private final ReadOnlyPropertyDescriptor.ReadOnlyListener<Boolean> listener;
8787

88+
@SuppressWarnings("removal")
8889
private final AccessControlContext acc = AccessController.getContext();
8990

9091
ReadOnlyJavaBeanBooleanProperty(ReadOnlyPropertyDescriptor descriptor, Object bean) {
@@ -101,6 +102,7 @@ public final class ReadOnlyJavaBeanBooleanProperty extends ReadOnlyBooleanProper
101102
* property throws an {@code IllegalAccessException} or an
102103
* {@code InvocationTargetException}.
103104
*/
105+
@SuppressWarnings("removal")
104106
@Override
105107
public boolean get() {
106108
return AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> {

modules/javafx.base/src/main/java/javafx/beans/property/adapter/ReadOnlyJavaBeanDoubleProperty.java

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public final class ReadOnlyJavaBeanDoubleProperty extends ReadOnlyDoubleProperty
8585
private final ReadOnlyPropertyDescriptor descriptor;
8686
private final ReadOnlyPropertyDescriptor.ReadOnlyListener<Number> listener;
8787

88+
@SuppressWarnings("removal")
8889
private final AccessControlContext acc = AccessController.getContext();
8990

9091
ReadOnlyJavaBeanDoubleProperty(ReadOnlyPropertyDescriptor descriptor, Object bean) {
@@ -101,6 +102,7 @@ public final class ReadOnlyJavaBeanDoubleProperty extends ReadOnlyDoubleProperty
101102
* property throws an {@code IllegalAccessException} or an
102103
* {@code InvocationTargetException}.
103104
*/
105+
@SuppressWarnings("removal")
104106
@Override
105107
public double get() {
106108
return AccessController.doPrivileged((PrivilegedAction<Double>) () -> {

modules/javafx.base/src/main/java/javafx/beans/property/adapter/ReadOnlyJavaBeanFloatProperty.java

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public final class ReadOnlyJavaBeanFloatProperty extends ReadOnlyFloatPropertyBa
8585
private final ReadOnlyPropertyDescriptor descriptor;
8686
private final ReadOnlyPropertyDescriptor.ReadOnlyListener<Number> listener;
8787

88+
@SuppressWarnings("removal")
8889
private final AccessControlContext acc = AccessController.getContext();
8990

9091
ReadOnlyJavaBeanFloatProperty(ReadOnlyPropertyDescriptor descriptor, Object bean) {
@@ -101,6 +102,7 @@ public final class ReadOnlyJavaBeanFloatProperty extends ReadOnlyFloatPropertyBa
101102
* property throws an {@code IllegalAccessException} or an
102103
* {@code InvocationTargetException}.
103104
*/
105+
@SuppressWarnings("removal")
104106
@Override
105107
public float get() {
106108
return AccessController.doPrivileged((PrivilegedAction<Float>) () -> {

modules/javafx.base/src/main/java/javafx/beans/property/adapter/ReadOnlyJavaBeanIntegerProperty.java

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public final class ReadOnlyJavaBeanIntegerProperty extends ReadOnlyIntegerProper
8585
private final ReadOnlyPropertyDescriptor descriptor;
8686
private final ReadOnlyPropertyDescriptor.ReadOnlyListener<Number> listener;
8787

88+
@SuppressWarnings("removal")
8889
private final AccessControlContext acc = AccessController.getContext();
8990

9091
ReadOnlyJavaBeanIntegerProperty(ReadOnlyPropertyDescriptor descriptor, Object bean) {
@@ -101,6 +102,7 @@ public final class ReadOnlyJavaBeanIntegerProperty extends ReadOnlyIntegerProper
101102
* property throws an {@code IllegalAccessException} or an
102103
* {@code InvocationTargetException}.
103104
*/
105+
@SuppressWarnings("removal")
104106
@Override
105107
public int get() {
106108
return AccessController.doPrivileged((PrivilegedAction<Integer>) () -> {

0 commit comments

Comments
 (0)