8231262: Suppress warnings on non-serializable instance fields in security libs serializable classes
Reviewed-by: mullan, chegar
--- a/src/java.base/share/classes/java/security/GuardedObject.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/java/security/GuardedObject.java Wed Oct 09 09:57:41 2019 -0700
@@ -52,7 +52,9 @@
@java.io.Serial
private static final long serialVersionUID = -5240450096227834308L;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Object object; // the object we are guarding
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Guard guard; // the guard
/**
--- a/src/java.base/share/classes/java/security/SecureRandom.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/java/security/SecureRandom.java Wed Oct 09 09:57:41 2019 -0700
@@ -1043,6 +1043,7 @@
/**
* @serial
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private MessageDigest digest = null;
/**
* @serial
--- a/src/java.base/share/classes/javax/crypto/CryptoPermission.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/javax/crypto/CryptoPermission.java Wed Oct 09 09:57:41 2019 -0700
@@ -55,6 +55,7 @@
private String alg;
private int maxKeySize = Integer.MAX_VALUE; // no restriction on maxKeySize
private String exemptionMechanism = null;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameterSpec algParamSpec = null;
private boolean checkParam = false; // no restriction on param
--- a/src/java.base/share/classes/javax/security/auth/PrivateCredentialPermission.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/javax/security/auth/PrivateCredentialPermission.java Wed Oct 09 09:57:41 2019 -0700
@@ -119,6 +119,7 @@
* The set contains elements of type,
* {@code PrivateCredentialPermission.CredOwner}.
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Set<Principal> principals; // ignored - kept around for compatibility
private transient CredOwner[] credOwners;
--- a/src/java.base/share/classes/javax/security/auth/Subject.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/javax/security/auth/Subject.java Wed Oct 09 09:57:41 2019 -0700
@@ -111,6 +111,7 @@
* {@code java.security.Principal}.
* The set is a {@code Subject.SecureSet}.
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
Set<Principal> principals;
/**
--- a/src/java.base/share/classes/javax/security/auth/callback/UnsupportedCallbackException.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/javax/security/auth/callback/UnsupportedCallbackException.java Wed Oct 09 09:57:41 2019 -0700
@@ -39,6 +39,7 @@
/**
* @serial
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Callback callback;
/**
--- a/src/java.base/share/classes/sun/security/internal/spec/TlsKeyMaterialSpec.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/sun/security/internal/spec/TlsKeyMaterialSpec.java Wed Oct 09 09:57:41 2019 -0700
@@ -50,7 +50,11 @@
private final SecretKey clientMacKey, serverMacKey;
private final SecretKey clientCipherKey, serverCipherKey;
- private final IvParameterSpec clientIv, serverIv;
+
+ @SuppressWarnings("serial") // Not statically typed as Serializable
+ private final IvParameterSpec clientIv;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
+ private final IvParameterSpec serverIv;
/**
* Constructs a new TlsKeymaterialSpec from the client and server MAC
--- a/src/java.base/share/classes/sun/security/provider/PolicyParser.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/sun/security/provider/PolicyParser.java Wed Oct 09 09:57:41 2019 -0700
@@ -1315,7 +1315,9 @@
private static final long serialVersionUID = -4330692689482574072L;
private String i18nMessage;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private LocalizedMessage localizedMsg;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Object[] source;
/**
--- a/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java Wed Oct 09 09:57:41 2019 -0700
@@ -54,6 +54,7 @@
private static final Class<?>[] PARAMS = { String.class };
private static final sun.security.util.Debug debug =
sun.security.util.Debug.getInstance("auth", "\t[Auth Access]");
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private ClassLoader sysClassLoader;
/**
--- a/src/java.base/share/classes/sun/security/provider/certpath/X509CertPath.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/sun/security/provider/certpath/X509CertPath.java Wed Oct 09 09:57:41 2019 -0700
@@ -69,6 +69,7 @@
/**
* List of certificates in this chain
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private List<X509Certificate> certs;
/**
--- a/src/java.base/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java Wed Oct 09 09:57:41 2019 -0700
@@ -70,6 +70,7 @@
// Optional parameters associated with this RSA key
// specified in the encoding of its AlgorithmId.
// Must be null for "RSA" keys.
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameterSpec keyParams;
/**
--- a/src/java.base/share/classes/sun/security/rsa/RSAPrivateKeyImpl.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/sun/security/rsa/RSAPrivateKeyImpl.java Wed Oct 09 09:57:41 2019 -0700
@@ -61,6 +61,7 @@
// optional parameters associated with this RSA key
// specified in the encoding of its AlgorithmId.
// must be null for "RSA" keys.
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final AlgorithmParameterSpec keyParams;
/**
--- a/src/java.base/share/classes/sun/security/rsa/RSAPublicKeyImpl.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/sun/security/rsa/RSAPublicKeyImpl.java Wed Oct 09 09:57:41 2019 -0700
@@ -62,6 +62,7 @@
// optional parameters associated with this RSA key
// specified in the encoding of its AlgorithmId
// must be null for "RSA" keys.
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameterSpec keyParams;
/**
--- a/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java Wed Oct 09 09:57:41 2019 -0700
@@ -98,6 +98,7 @@
* Changed to Object
* @serial
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Object components = null; // path from root
/**
* @serial
--- a/src/java.base/share/classes/sun/security/validator/ValidatorException.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/sun/security/validator/ValidatorException.java Wed Oct 09 09:57:41 2019 -0700
@@ -62,6 +62,7 @@
public static final Object T_UNTRUSTED_CERT =
"Untrusted certificate";
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Object type;
private X509Certificate cert;
--- a/src/java.base/share/classes/sun/security/x509/AlgorithmId.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/sun/security/x509/AlgorithmId.java Wed Oct 09 09:57:41 2019 -0700
@@ -72,6 +72,7 @@
private ObjectIdentifier algid;
// The (parsed) parameters
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameters algParams;
private boolean constructedFromDer = true;
@@ -80,6 +81,7 @@
* DER-encoded form; subclasses can be made to automaticaly parse
* them so there is fast access to these parameters.
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
protected DerValue params;
--- a/src/java.base/share/classes/sun/security/x509/X509CertImpl.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/sun/security/x509/X509CertImpl.java Wed Oct 09 09:57:41 2019 -0700
@@ -70,6 +70,7 @@
* @author Hemma Prafullchandra
* @see X509CertInfo
*/
+@SuppressWarnings("serial") // See writeReplace method in Certificate
public class X509CertImpl extends X509Certificate implements DerEncoder {
@java.io.Serial
--- a/src/java.base/share/classes/sun/security/x509/X509Key.java Wed Oct 09 17:38:58 2019 +0100
+++ b/src/java.base/share/classes/sun/security/x509/X509Key.java Wed Oct 09 09:57:41 2019 -0700
@@ -84,7 +84,7 @@
private int unusedBits = 0;
/* BitArray form of key */
- private BitArray bitStringKey = null;
+ private transient BitArray bitStringKey = null;
/* The encoding for the key. */
protected byte[] encodedKey;