8269409: Post JEP 411 refactoring: core-libs with maximum covering > 10K

Reviewed-by: lancea, naoto
This commit is contained in:
Weijun Wang 2021-06-28 19:05:33 +00:00
parent d0d26f5c55
commit e9b2c058a4
21 changed files with 229 additions and 128 deletions

View file

@ -560,7 +560,6 @@ public interface ObjectInputFilter {
* fully qualified class name of the deserialization filter factory.
* @since 9
*/
@SuppressWarnings("removal")
final class Config {
/**
* Lock object for filter and filter factory.
@ -628,19 +627,17 @@ public interface ObjectInputFilter {
*/
// Get the values of the system properties, if they are defined
String factoryClassName = StaticProperty.jdkSerialFilterFactory();
if (factoryClassName == null) {
// Fallback to security property
factoryClassName = AccessController.doPrivileged((PrivilegedAction<String>) () ->
@SuppressWarnings("removal")
String factoryClassName = StaticProperty.jdkSerialFilterFactory() != null
? StaticProperty.jdkSerialFilterFactory()
: AccessController.doPrivileged((PrivilegedAction<String>) () ->
Security.getProperty(SERIAL_FILTER_FACTORY_PROPNAME));
}
String filterString = StaticProperty.jdkSerialFilter();
if (filterString == null) {
// Fallback to security property
filterString = AccessController.doPrivileged((PrivilegedAction<String>) () ->
@SuppressWarnings("removal")
String filterString = StaticProperty.jdkSerialFilter() != null
? StaticProperty.jdkSerialFilter()
: AccessController.doPrivileged((PrivilegedAction<String>) () ->
Security.getProperty(SERIAL_FILTER_PROPNAME));
}
traceFilters = GetBooleanAction.privilegedGetProperty(SERIAL_FILTER_TRACE_PROPNAME);
@ -743,6 +740,7 @@ public interface ObjectInputFilter {
*/
public static void setSerialFilter(ObjectInputFilter filter) {
Objects.requireNonNull(filter, "filter");
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(ObjectStreamConstants.SERIAL_FILTER_PERMISSION);
@ -836,6 +834,7 @@ public interface ObjectInputFilter {
*/
public static void setSerialFilterFactory(BinaryOperator<ObjectInputFilter> filterFactory) {
Objects.requireNonNull(filterFactory, "filterFactory");
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(ObjectStreamConstants.SERIAL_FILTER_PERMISSION);

View file

@ -72,7 +72,6 @@ import jdk.internal.icu.text.UCharacterIterator;
* @since 1.6
*
*/
@SuppressWarnings("removal")
public final class IDN {
/**
* Flag to allow processing of unassigned code points
@ -224,19 +223,15 @@ public final class IDN {
private static StringPrep namePrep = null;
static {
InputStream stream = null;
try {
final String IDN_PROFILE = "/sun/net/idn/uidna.spp";
if (System.getSecurityManager() != null) {
stream = AccessController.doPrivileged(new PrivilegedAction<>() {
public InputStream run() {
return StringPrep.class.getResourceAsStream(IDN_PROFILE);
}
});
} else {
stream = StringPrep.class.getResourceAsStream(IDN_PROFILE);
}
@SuppressWarnings("removal")
InputStream stream = System.getSecurityManager() != null
? AccessController.doPrivileged(new PrivilegedAction<>() {
public InputStream run() {
return StringPrep.class.getResourceAsStream(IDN_PROFILE);
}})
: StringPrep.class.getResourceAsStream(IDN_PROFILE);
namePrep = new StringPrep(stream);
stream.close();

View file

@ -202,7 +202,6 @@ import sun.util.logging.PlatformLogger;
*
* @since 1.8
*/
@SuppressWarnings("removal")
public final class HijrahChronology extends AbstractChronology implements Serializable {
/**
@ -291,8 +290,10 @@ public final class HijrahChronology extends AbstractChronology implements Serial
AbstractChronology.registerChrono(INSTANCE, "islamic");
// custom config chronologies
CONF_PATH = Path.of(AccessController.doPrivileged((PrivilegedAction<String>)
() -> System.getProperty("java.home")), "conf", "chronology");
@SuppressWarnings("removal")
String javaHome = AccessController.doPrivileged((PrivilegedAction<String>)
() -> System.getProperty("java.home"));
CONF_PATH = Path.of(javaHome, "conf", "chronology");
registerCustomChrono();
}
@ -840,7 +841,7 @@ public final class HijrahChronology extends AbstractChronology implements Serial
};
FilePermission perm1 = new FilePermission("<<ALL FILES>>", "read");
RuntimePermission perm2 = new RuntimePermission("accessSystemModules");
try (InputStream is = AccessController.doPrivileged(getResourceAction, null, perm1, perm2)) {
try (@SuppressWarnings("removal") InputStream is = AccessController.doPrivileged(getResourceAction, null, perm1, perm2)) {
if (is == null) {
throw new RuntimeException("Hijrah calendar resource not found: " + resourceName);
}
@ -1035,6 +1036,7 @@ public final class HijrahChronology extends AbstractChronology implements Serial
* Look for Hijrah chronology variant properties files in
* <JAVA_HOME>/conf/chronology directory. Then register its chronology, if any.
*/
@SuppressWarnings("removal")
private static void registerCustomChrono() {
AccessController.doPrivileged(
(PrivilegedAction<Void>)() -> {

View file

@ -127,7 +127,6 @@ import java.util.Collections;
*
* @since 1.8
*/
@SuppressWarnings("removal")
public abstract class ZoneRulesProvider {
/**
@ -147,26 +146,28 @@ public abstract class ZoneRulesProvider {
static {
// if the property java.time.zone.DefaultZoneRulesProvider is
// set then its value is the class name of the default provider
final List<ZoneRulesProvider> loaded = new ArrayList<>();
AccessController.doPrivileged(new PrivilegedAction<>() {
public Object run() {
String prop = System.getProperty("java.time.zone.DefaultZoneRulesProvider");
if (prop != null) {
try {
Class<?> c = Class.forName(prop, true, ClassLoader.getSystemClassLoader());
@SuppressWarnings("deprecation")
ZoneRulesProvider provider = ZoneRulesProvider.class.cast(c.newInstance());
registerProvider(provider);
loaded.add(provider);
} catch (Exception x) {
throw new Error(x);
@SuppressWarnings("removal")
final List<ZoneRulesProvider> loaded =
AccessController.doPrivileged(new PrivilegedAction<List<ZoneRulesProvider>>() {
public List<ZoneRulesProvider> run() {
List<ZoneRulesProvider> result = new ArrayList<>();
String prop = System.getProperty("java.time.zone.DefaultZoneRulesProvider");
if (prop != null) {
try {
Class<?> c = Class.forName(prop, true, ClassLoader.getSystemClassLoader());
@SuppressWarnings("deprecation")
ZoneRulesProvider provider = ZoneRulesProvider.class.cast(c.newInstance());
registerProvider(provider);
result.add(provider);
} catch (Exception x) {
throw new Error(x);
}
} else {
registerProvider(new TzdbZoneRulesProvider());
}
return result;
}
} else {
registerProvider(new TzdbZoneRulesProvider());
}
return null;
}
});
});
ServiceLoader<ZoneRulesProvider> sl = ServiceLoader.load(ZoneRulesProvider.class, ClassLoader.getSystemClassLoader());
Iterator<ZoneRulesProvider> it = sl.iterator();

View file

@ -111,7 +111,6 @@ import sun.util.logging.PlatformLogger;
* @see java.math.BigDecimal
* @since 1.4
*/
@SuppressWarnings("removal")
public final class Currency implements Serializable {
@java.io.Serial
@ -210,6 +209,11 @@ public final class Currency implements Serializable {
private static final int VALID_FORMAT_VERSION = 3;
static {
initStatic();
}
@SuppressWarnings("removal")
private static void initStatic() {
AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public Void run() {

View file

@ -47,7 +47,7 @@ import java.util.function.LongBinaryOperator;
* for classes supporting dynamic striping on 64bit values. The class
* extends Number so that concrete subclasses must publicly do so.
*/
@SuppressWarnings({"removal","serial"})
@SuppressWarnings("serial")
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
@ -382,12 +382,13 @@ abstract class Striped64 extends Number {
private static final VarHandle THREAD_PROBE;
static {
try {
MethodHandles.Lookup l = MethodHandles.lookup();
BASE = l.findVarHandle(Striped64.class,
MethodHandles.Lookup l1 = MethodHandles.lookup();
BASE = l1.findVarHandle(Striped64.class,
"base", long.class);
CELLSBUSY = l.findVarHandle(Striped64.class,
CELLSBUSY = l1.findVarHandle(Striped64.class,
"cellsBusy", int.class);
l = java.security.AccessController.doPrivileged(
@SuppressWarnings("removal")
MethodHandles.Lookup l2 = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<>() {
public MethodHandles.Lookup run() {
try {
@ -396,7 +397,7 @@ abstract class Striped64 extends Number {
throw new ExceptionInInitializerError(e);
}
}});
THREAD_PROBE = l.findVarHandle(Thread.class,
THREAD_PROBE = l2.findVarHandle(Thread.class,
"threadLocalRandomProbe", int.class);
} catch (ReflectiveOperationException e) {
throw new ExceptionInInitializerError(e);