8231262: Suppress warnings on non-serializable instance fields in security libs serializable classes

Reviewed-by: mullan, chegar
This commit is contained in:
Joe Darcy 2019-10-09 09:57:41 -07:00
parent a690af3832
commit fbb4093562
18 changed files with 25 additions and 2 deletions

View File

@ -52,7 +52,9 @@ public class GuardedObject implements java.io.Serializable {
@java.io.Serial @java.io.Serial
private static final long serialVersionUID = -5240450096227834308L; private static final long serialVersionUID = -5240450096227834308L;
@SuppressWarnings("serial") // Not statically typed as Serializable
private Object object; // the object we are guarding private Object object; // the object we are guarding
@SuppressWarnings("serial") // Not statically typed as Serializable
private Guard guard; // the guard private Guard guard; // the guard
/** /**

View File

@ -1043,6 +1043,7 @@ public class SecureRandom extends java.util.Random {
/** /**
* @serial * @serial
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
private MessageDigest digest = null; private MessageDigest digest = null;
/** /**
* @serial * @serial

View File

@ -55,6 +55,7 @@ class CryptoPermission extends java.security.Permission {
private String alg; private String alg;
private int maxKeySize = Integer.MAX_VALUE; // no restriction on maxKeySize private int maxKeySize = Integer.MAX_VALUE; // no restriction on maxKeySize
private String exemptionMechanism = null; private String exemptionMechanism = null;
@SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameterSpec algParamSpec = null; private AlgorithmParameterSpec algParamSpec = null;
private boolean checkParam = false; // no restriction on param private boolean checkParam = false; // no restriction on param

View File

@ -119,6 +119,7 @@ public final class PrivateCredentialPermission extends Permission {
* The set contains elements of type, * The set contains elements of type,
* {@code PrivateCredentialPermission.CredOwner}. * {@code PrivateCredentialPermission.CredOwner}.
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
private Set<Principal> principals; // ignored - kept around for compatibility private Set<Principal> principals; // ignored - kept around for compatibility
private transient CredOwner[] credOwners; private transient CredOwner[] credOwners;

View File

@ -111,6 +111,7 @@ public final class Subject implements java.io.Serializable {
* {@code java.security.Principal}. * {@code java.security.Principal}.
* The set is a {@code Subject.SecureSet}. * The set is a {@code Subject.SecureSet}.
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
Set<Principal> principals; Set<Principal> principals;
/** /**

View File

@ -39,6 +39,7 @@ public class UnsupportedCallbackException extends Exception {
/** /**
* @serial * @serial
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
private Callback callback; private Callback callback;
/** /**

View File

@ -50,7 +50,11 @@ public class TlsKeyMaterialSpec implements KeySpec, SecretKey {
private final SecretKey clientMacKey, serverMacKey; private final SecretKey clientMacKey, serverMacKey;
private final SecretKey clientCipherKey, serverCipherKey; 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 * Constructs a new TlsKeymaterialSpec from the client and server MAC

View File

@ -1315,7 +1315,9 @@ public class PolicyParser {
private static final long serialVersionUID = -4330692689482574072L; private static final long serialVersionUID = -4330692689482574072L;
private String i18nMessage; private String i18nMessage;
@SuppressWarnings("serial") // Not statically typed as Serializable
private LocalizedMessage localizedMsg; private LocalizedMessage localizedMsg;
@SuppressWarnings("serial") // Not statically typed as Serializable
private Object[] source; private Object[] source;
/** /**

View File

@ -54,6 +54,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
private static final Class<?>[] PARAMS = { String.class }; private static final Class<?>[] PARAMS = { String.class };
private static final sun.security.util.Debug debug = private static final sun.security.util.Debug debug =
sun.security.util.Debug.getInstance("auth", "\t[Auth Access]"); sun.security.util.Debug.getInstance("auth", "\t[Auth Access]");
@SuppressWarnings("serial") // Not statically typed as Serializable
private ClassLoader sysClassLoader; private ClassLoader sysClassLoader;
/** /**

View File

@ -69,6 +69,7 @@ public class X509CertPath extends CertPath {
/** /**
* List of certificates in this chain * List of certificates in this chain
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
private List<X509Certificate> certs; private List<X509Certificate> certs;
/** /**

View File

@ -70,6 +70,7 @@ public final class RSAPrivateCrtKeyImpl
// Optional parameters associated with this RSA key // Optional parameters associated with this RSA key
// specified in the encoding of its AlgorithmId. // specified in the encoding of its AlgorithmId.
// Must be null for "RSA" keys. // Must be null for "RSA" keys.
@SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameterSpec keyParams; private AlgorithmParameterSpec keyParams;
/** /**

View File

@ -61,6 +61,7 @@ public final class RSAPrivateKeyImpl extends PKCS8Key implements RSAPrivateKey {
// optional parameters associated with this RSA key // optional parameters associated with this RSA key
// specified in the encoding of its AlgorithmId. // specified in the encoding of its AlgorithmId.
// must be null for "RSA" keys. // must be null for "RSA" keys.
@SuppressWarnings("serial") // Not statically typed as Serializable
private final AlgorithmParameterSpec keyParams; private final AlgorithmParameterSpec keyParams;
/** /**

View File

@ -62,6 +62,7 @@ public final class RSAPublicKeyImpl extends X509Key implements RSAPublicKey {
// optional parameters associated with this RSA key // optional parameters associated with this RSA key
// specified in the encoding of its AlgorithmId // specified in the encoding of its AlgorithmId
// must be null for "RSA" keys. // must be null for "RSA" keys.
@SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameterSpec keyParams; private AlgorithmParameterSpec keyParams;
/** /**

View File

@ -98,6 +98,7 @@ class ObjectIdentifier implements Serializable
* Changed to Object * Changed to Object
* @serial * @serial
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
private Object components = null; // path from root private Object components = null; // path from root
/** /**
* @serial * @serial

View File

@ -62,6 +62,7 @@ public class ValidatorException extends CertificateException {
public static final Object T_UNTRUSTED_CERT = public static final Object T_UNTRUSTED_CERT =
"Untrusted certificate"; "Untrusted certificate";
@SuppressWarnings("serial") // Not statically typed as Serializable
private Object type; private Object type;
private X509Certificate cert; private X509Certificate cert;

View File

@ -72,6 +72,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
private ObjectIdentifier algid; private ObjectIdentifier algid;
// The (parsed) parameters // The (parsed) parameters
@SuppressWarnings("serial") // Not statically typed as Serializable
private AlgorithmParameters algParams; private AlgorithmParameters algParams;
private boolean constructedFromDer = true; private boolean constructedFromDer = true;
@ -80,6 +81,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
* DER-encoded form; subclasses can be made to automaticaly parse * DER-encoded form; subclasses can be made to automaticaly parse
* them so there is fast access to these parameters. * them so there is fast access to these parameters.
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
protected DerValue params; protected DerValue params;

View File

@ -70,6 +70,7 @@ import sun.security.provider.X509Factory;
* @author Hemma Prafullchandra * @author Hemma Prafullchandra
* @see X509CertInfo * @see X509CertInfo
*/ */
@SuppressWarnings("serial") // See writeReplace method in Certificate
public class X509CertImpl extends X509Certificate implements DerEncoder { public class X509CertImpl extends X509Certificate implements DerEncoder {
@java.io.Serial @java.io.Serial

View File

@ -84,7 +84,7 @@ public class X509Key implements PublicKey {
private int unusedBits = 0; private int unusedBits = 0;
/* BitArray form of key */ /* BitArray form of key */
private BitArray bitStringKey = null; private transient BitArray bitStringKey = null;
/* The encoding for the key. */ /* The encoding for the key. */
protected byte[] encodedKey; protected byte[] encodedKey;