Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -560,7 +560,6 @@ enum Status {
* 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 @@ final class Config {
*/

// 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 static ObjectInputFilter getSerialFilter() {
*/
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 @@ static BinaryOperator<ObjectInputFilter> getSerialFilterFactorySingleton() {
*/
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 @@
* @since 1.6
*
*/
@SuppressWarnings("removal")
public final class IDN {
/**
* Flag to allow processing of unassigned code points
@@ -224,19 +223,15 @@ public static String toUnicode(String input) {
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 @@
*
* @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();
}

@@ -847,7 +848,7 @@ private static Properties readConfigProperties(final String chronologyId, final
};
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);
}
@@ -1042,6 +1043,7 @@ private int[] parseYMD(String string) {
* 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 @@
*
* @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 @@
* @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 @@
* 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 @@ else if (casBase(v = base, apply(fn, v, x)))
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 @@ public MethodHandles.Lookup run() {
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.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 Void run() {
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 synchronized Enumeration<MimeEntry> elements() {
// 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 @@ protected boolean saveAsProperties(File file) {
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 @@
// 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 @@
* <p>
* @since 1.8
*/
@SuppressWarnings("removal")
public final class ZoneInfoFile {

/**
@@ -249,6 +248,11 @@ private 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 {