8267543: Post JEP 411 refactoring: security

Reviewed-by: mullan
This commit is contained in:
Weijun Wang 2021-06-02 15:47:57 +00:00
parent 476775808f
commit 40d23a0c0b
19 changed files with 80 additions and 79 deletions

View file

@ -987,10 +987,9 @@ public class KeyStore {
* if no such property exists.
* @see java.security.Security security properties
*/
@SuppressWarnings("removal")
public static final String getDefaultType() {
String kstype;
kstype = AccessController.doPrivileged(new PrivilegedAction<>() {
@SuppressWarnings("removal")
String kstype = AccessController.doPrivileged(new PrivilegedAction<>() {
public String run() {
return Security.getProperty(KEYSTORE_TYPE);
}
@ -1957,7 +1956,6 @@ public class KeyStore {
* of either PasswordProtection or CallbackHandlerProtection; or
* if file does not exist or does not refer to a normal file
*/
@SuppressWarnings("removal")
public static Builder newInstance(String type, Provider provider,
File file, ProtectionParameter protection) {
if ((type == null) || (file == null) || (protection == null)) {
@ -1974,8 +1972,9 @@ public class KeyStore {
("File does not exist or it does not refer " +
"to a normal file: " + file);
}
return new FileBuilder(type, provider, file, protection,
AccessController.getContext());
@SuppressWarnings("removal")
var acc = AccessController.getContext();
return new FileBuilder(type, provider, file, protection, acc);
}
/**

View file

@ -51,7 +51,6 @@ import sun.security.jca.*;
* @since 1.1
*/
@SuppressWarnings("removal")
public final class Security {
/* Are we debugging? -- for developers */
@ -72,7 +71,8 @@ public final class Security {
// things in initialize that might require privs.
// (the FileInputStream call and the File.exists call,
// the securityPropFile call, etc)
AccessController.doPrivileged(new PrivilegedAction<>() {
@SuppressWarnings("removal")
var dummy = AccessController.doPrivileged(new PrivilegedAction<>() {
public Void run() {
initialize();
return null;
@ -761,6 +761,7 @@ public final class Security {
* @see java.security.SecurityPermission
*/
public static String getProperty(String key) {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SecurityPermission("getProperty."+
@ -828,6 +829,7 @@ public final class Security {
}
private static void check(String directive) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkSecurityAccess(directive);
@ -835,6 +837,7 @@ public final class Security {
}
private static void checkInsertProvider(String name) {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
try {