mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-19 02:24:40 +02:00
8269409: Post JEP 411 refactoring: core-libs with maximum covering > 10K
Reviewed-by: lancea, naoto
This commit is contained in:
parent
d0d26f5c55
commit
e9b2c058a4
21 changed files with 229 additions and 128 deletions
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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>)() -> {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -33,7 +33,6 @@ import java.util.Enumeration;
|
|||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public class MimeTable implements FileNameMap {
|
||||
/** Keyed by content type, returns MimeEntries */
|
||||
private Hashtable<String, MimeEntry> entries
|
||||
|
@ -44,28 +43,15 @@ public class MimeTable implements FileNameMap {
|
|||
= new Hashtable<String, MimeEntry>();
|
||||
|
||||
// Will be reset if in the platform-specific data file
|
||||
private static String tempFileTemplate;
|
||||
|
||||
static {
|
||||
@SuppressWarnings("removal")
|
||||
private static String tempFileTemplate =
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
tempFileTemplate =
|
||||
System.getProperty("content.types.temp.file.template",
|
||||
"/tmp/%s");
|
||||
|
||||
mailcapLocations = new String[] {
|
||||
System.getProperty("user.mailcap"),
|
||||
StaticProperty.userHome() + "/.mailcap",
|
||||
"/etc/mailcap",
|
||||
"/usr/etc/mailcap",
|
||||
"/usr/local/etc/mailcap",
|
||||
};
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
new java.security.PrivilegedAction<String>() {
|
||||
public String run() {
|
||||
return System.getProperty("content.types.temp.file.template",
|
||||
"/tmp/%s");
|
||||
}
|
||||
});
|
||||
|
||||
private static final String filePreamble = "sun.net.www MIME content-types table";
|
||||
private static final String fileMagic = "#" + filePreamble;
|
||||
|
@ -77,6 +63,7 @@ public class MimeTable implements FileNameMap {
|
|||
private static class DefaultInstanceHolder {
|
||||
static final MimeTable defaultInstance = getDefaultInstance();
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
static MimeTable getDefaultInstance() {
|
||||
return java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<MimeTable>() {
|
||||
|
@ -220,7 +207,20 @@ public class MimeTable implements FileNameMap {
|
|||
// For backward compatibility -- mailcap format files
|
||||
// This is not currently used, but may in the future when we add ability
|
||||
// to read BOTH the properties format and the mailcap format.
|
||||
protected static String[] mailcapLocations;
|
||||
@SuppressWarnings("removal")
|
||||
protected static String[] mailcapLocations =
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<String[]>() {
|
||||
public String[] run() {
|
||||
return new String[]{
|
||||
System.getProperty("user.mailcap"),
|
||||
StaticProperty.userHome() + "/.mailcap",
|
||||
"/etc/mailcap",
|
||||
"/usr/etc/mailcap",
|
||||
"/usr/local/etc/mailcap",
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
public synchronized void load() {
|
||||
Properties entries = new Properties();
|
||||
|
@ -388,6 +388,7 @@ public class MimeTable implements FileNameMap {
|
|||
properties.put("temp.file.template", tempFileTemplate);
|
||||
String tag;
|
||||
// Perform the property security check for user.name
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPropertyAccess("user.name");
|
||||
|
|
|
@ -53,7 +53,6 @@ import sun.net.www.HeaderParser;
|
|||
// policy in HttpURLConnection. A failure on baz.foo.com shouldn't
|
||||
// uncache foo.com!
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public abstract class AuthenticationInfo extends AuthCacheValue implements Cloneable {
|
||||
|
||||
@java.io.Serial
|
||||
|
@ -70,12 +69,10 @@ public abstract class AuthenticationInfo extends AuthCacheValue implements Clone
|
|||
* repeatedly, via the Authenticator. Default is false, which means that this
|
||||
* behavior is switched off.
|
||||
*/
|
||||
static final boolean serializeAuth;
|
||||
static {
|
||||
serializeAuth = java.security.AccessController.doPrivileged(
|
||||
@SuppressWarnings("removal")
|
||||
static final boolean serializeAuth = java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetBooleanAction(
|
||||
"http.auth.serializeRequests")).booleanValue();
|
||||
}
|
||||
|
||||
/* AuthCacheValue: */
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ import sun.security.action.GetPropertyAction;
|
|||
* <p>
|
||||
* @since 1.8
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public final class ZoneInfoFile {
|
||||
|
||||
/**
|
||||
|
@ -249,6 +248,11 @@ public final class ZoneInfoFile {
|
|||
.privilegedGetProperty("sun.timezone.ids.oldmapping", "false")
|
||||
.toLowerCase(Locale.ROOT);
|
||||
USE_OLDMAPPING = (oldmapping.equals("yes") || oldmapping.equals("true"));
|
||||
loadTZDB();
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static void loadTZDB() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue