8229999: Apply java.io.Serial annotations to security types in java.base

Reviewed-by: rriggs, mullan
This commit is contained in:
Joe Darcy 2019-08-29 10:52:21 -07:00
parent 470d32df73
commit 6d4ef5aaf3
158 changed files with 377 additions and 141 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -43,6 +43,7 @@ package java.security;
public class AccessControlException extends SecurityException {
@java.io.Serial
private static final long serialVersionUID = 5138225684096988535L;
// the permission that caused the exception to be thrown.

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -58,6 +58,7 @@ import sun.security.util.SecurityConstants;
public final class AllPermission extends Permission {
@java.io.Serial
private static final long serialVersionUID = -2916474571451318075L;
/**
@ -157,6 +158,7 @@ final class AllPermissionCollection
{
// use serialVersionUID from JDK 1.2.2 for interoperability
@java.io.Serial
private static final long serialVersionUID = -4023755556366636806L;
private boolean all_allowed; // true if any all permissions have been added

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -41,6 +41,7 @@ import javax.security.auth.callback.CallbackHandler;
*/
public abstract class AuthProvider extends Provider {
@java.io.Serial
private static final long serialVersionUID = 4197859053084546461L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -69,6 +69,7 @@ public abstract class BasicPermission extends Permission
implements java.io.Serializable
{
@java.io.Serial
private static final long serialVersionUID = 6279438298436773498L;
// does this permission have a wildcard at the end?
@ -260,6 +261,7 @@ public abstract class BasicPermission extends Permission
* readObject is called to restore the state of the BasicPermission from
* a stream.
*/
@java.io.Serial
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException
{
@ -305,6 +307,7 @@ final class BasicPermissionCollection
implements java.io.Serializable
{
@java.io.Serial
private static final long serialVersionUID = 739301742472979399L;
/**
@ -478,6 +481,7 @@ final class BasicPermissionCollection
* The class to which all BasicPermissions in this
* BasicPermissionCollection belongs.
*/
@java.io.Serial
private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("permissions", Hashtable.class),
new ObjectStreamField("all_allowed", Boolean.TYPE),
@ -492,6 +496,7 @@ final class BasicPermissionCollection
* serialization compatibility with earlier releases. all_allowed
* and permClass unchanged.
*/
@java.io.Serial
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
@ -513,6 +518,7 @@ final class BasicPermissionCollection
* readObject is called to restore the state of the
* BasicPermissionCollection from a stream.
*/
@java.io.Serial
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException
{

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,6 +38,7 @@ import java.security.cert.CertPath;
public final class CodeSigner implements Serializable {
@java.io.Serial
private static final long serialVersionUID = 6819288105193937581L;
/**
@ -165,6 +166,7 @@ public final class CodeSigner implements Serializable {
}
// Explicitly reset hash code value to -1
@java.io.Serial
private void readObject(ObjectInputStream ois)
throws IOException, ClassNotFoundException {
ois.defaultReadObject();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -50,6 +50,7 @@ import sun.security.util.IOUtils;
public class CodeSource implements java.io.Serializable {
@java.io.Serial
private static final long serialVersionUID = 4977541819976013951L;
/**
@ -522,6 +523,7 @@ public class CodeSource implements java.io.Serializable {
* array of bytes. Finally, if any code signers are present then the array
* of code signers is serialized and written out too.
*/
@java.io.Serial
private void writeObject(java.io.ObjectOutputStream oos)
throws IOException
{
@ -556,6 +558,7 @@ public class CodeSource implements java.io.Serializable {
/**
* Restores this object from a stream (i.e., deserializes it).
*/
@java.io.Serial
private void readObject(java.io.ObjectInputStream ois)
throws IOException, ClassNotFoundException
{

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,6 +33,7 @@ package java.security;
*/
public class DigestException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = 5821450303093652515L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,7 @@ package java.security;
public class GeneralSecurityException extends Exception {
@java.io.Serial
private static final long serialVersionUID = 894798122053539237L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -49,6 +49,7 @@ package java.security;
public class GuardedObject implements java.io.Serializable {
@java.io.Serial
private static final long serialVersionUID = -5240450096227834308L;
private Object object; // the object we are guarding
@ -92,6 +93,7 @@ public class GuardedObject implements java.io.Serializable {
* Writes this object out to a stream (i.e., serializes it).
* We check the guard if there is one.
*/
@java.io.Serial
private void writeObject(java.io.ObjectOutputStream oos)
throws java.io.IOException
{

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -62,6 +62,7 @@ import java.util.*;
public abstract class Identity implements Principal, Serializable {
/** use serialVersionUID from JDK 1.1.x for interoperability */
@java.io.Serial
private static final long serialVersionUID = 3609922007826600659L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -67,6 +67,7 @@ import java.util.Properties;
public abstract
class IdentityScope extends Identity {
@java.io.Serial
private static final long serialVersionUID = -2337346281189773310L;
/* The system's scope */

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,6 +40,7 @@ package java.security;
public class InvalidAlgorithmParameterException
extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = 2864672297499471472L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,7 @@ package java.security;
public class InvalidKeyException extends KeyException {
@java.io.Serial
private static final long serialVersionUID = 5698479920593359816L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,7 @@ package java.security;
public class InvalidParameterException extends IllegalArgumentException {
@java.io.Serial
private static final long serialVersionUID = -857968536935667808L;
/**

View file

@ -114,6 +114,7 @@ public interface Key extends java.io.Serializable {
*/
@Deprecated
@SuppressWarnings("serial")
@java.io.Serial
static final long serialVersionUID = 6603384152749567654L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,6 +38,7 @@ package java.security;
public class KeyException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = -7483676942812432108L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -46,6 +46,7 @@ package java.security;
public class KeyManagementException extends KeyException {
@java.io.Serial
private static final long serialVersionUID = 947674216157062695L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -41,6 +41,7 @@ import java.util.*;
public final class KeyPair implements java.io.Serializable {
@java.io.Serial
private static final long serialVersionUID = -7565189502268009837L;
private PrivateKey privateKey;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -57,6 +57,7 @@ import javax.crypto.spec.SecretKeySpec;
public class KeyRep implements Serializable {
@java.io.Serial
private static final long serialVersionUID = -4757683898830641853L;
/**
@ -162,6 +163,7 @@ public class KeyRep implements Serializable {
* encoded key bytes are unrecognized/invalid, of if the
* resolution of the key fails for any reason
*/
@java.io.Serial
protected Object readResolve() throws ObjectStreamException {
try {
if (type == Type.SECRET && RAW.equals(format)) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,7 @@ package java.security;
public class KeyStoreException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = -1119353179322377262L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,6 +35,7 @@ package java.security;
public class NoSuchAlgorithmException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = -7443947487218346562L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,6 +35,7 @@ package java.security;
public class NoSuchProviderException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = 8488111756688534474L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -65,6 +65,7 @@ package java.security;
public abstract class Permission implements Guard, java.io.Serializable {
@java.io.Serial
private static final long serialVersionUID = -5636570222231596674L;
private String name;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -96,6 +96,7 @@ import java.util.stream.StreamSupport;
public abstract class PermissionCollection implements java.io.Serializable {
@java.io.Serial
private static final long serialVersionUID = -6727011328946861783L;
// when set, add will throw an exception.

View file

@ -328,6 +328,7 @@ implements Serializable
return pc;
}
@java.io.Serial
private static final long serialVersionUID = 4858622370623524688L;
// Need to maintain serialization interoperability with earlier releases,
@ -339,6 +340,7 @@ implements Serializable
* A table of the Permission classes and PermissionCollections.
* @serialField allPermission java.security.PermissionCollection
*/
@java.io.Serial
private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("perms", Hashtable.class),
new ObjectStreamField("allPermission", PermissionCollection.class),
@ -352,6 +354,7 @@ implements Serializable
* serialization compatibility with earlier releases. allPermission
* unchanged.
*/
@java.io.Serial
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
@ -372,6 +375,7 @@ implements Serializable
* Reads in a Hashtable of Class/PermissionCollections and saves them in the
* permsMap field. Reads in allPermission.
*/
@java.io.Serial
private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
// Don't call defaultReadObject()
@ -547,6 +551,7 @@ implements Serializable
return permsMap.elements();
}
@java.io.Serial
private static final long serialVersionUID = -8491988220802933440L;
// Need to maintain serialization interoperability with earlier releases,
// which had the serializable field:
@ -555,6 +560,7 @@ implements Serializable
* @serialField perms java.util.Hashtable
* A table of the Permissions (both key and value are same).
*/
@java.io.Serial
private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("perms", Hashtable.class),
};
@ -566,6 +572,7 @@ implements Serializable
* Writes the contents of the permsMap field out as a Hashtable for
* serialization compatibility with earlier releases.
*/
@java.io.Serial
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
@ -584,6 +591,7 @@ implements Serializable
* Reads in a Hashtable of Permission/Permission and saves them in the
* permsMap field.
*/
@java.io.Serial
private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
// Don't call defaultReadObject()

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -818,6 +818,7 @@ public abstract class Policy {
private static class UnsupportedEmptyCollection
extends PermissionCollection {
@java.io.Serial
private static final long serialVersionUID = -8492269157353014774L;
private Permissions perms;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -69,5 +69,6 @@ public interface PrivateKey extends Key, javax.security.auth.Destroyable {
*/
@Deprecated
@SuppressWarnings("serial")
@java.io.Serial
static final long serialVersionUID = 6034044314589513430L;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -56,6 +56,7 @@ import jdk.internal.access.SharedSecrets;
*/
public class PrivilegedActionException extends Exception {
// use serialVersionUID from JDK 1.2.2 for interoperability
@java.io.Serial
private static final long serialVersionUID = 4724086851538908602L;
/**
@ -99,6 +100,7 @@ public class PrivilegedActionException extends Exception {
*
* @serialField undeclaredThrowable Throwable
*/
@java.io.Serial
private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("exception", Exception.class)
};
@ -112,6 +114,7 @@ public class PrivilegedActionException extends Exception {
* field in the older implementation and PrivilegedActionException::cause
* was set to null.
*/
@java.io.Serial
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField fields = s.readFields();
Exception exception = (Exception) fields.get("exception", null);
@ -124,6 +127,7 @@ public class PrivilegedActionException extends Exception {
* To maintain compatibility with older implementation, write a serial
* "exception" field with the cause as the value.
*/
@java.io.Serial
private void writeObject(ObjectOutputStream out) throws IOException {
ObjectOutputStream.PutField fields = out.putFields();
fields.put("exception", super.getCause());

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -108,6 +108,7 @@ import java.util.concurrent.ConcurrentHashMap;
public abstract class Provider extends Properties {
// Declare serialVersionUID to be compatible with JDK1.1
@java.io.Serial
private static final long serialVersionUID = -4298000515446427739L;
private static final sun.security.util.Debug debug =
@ -890,6 +891,7 @@ public abstract class Provider extends Properties {
* @param in the {@code ObjectInputStream} to read
* @serial
*/
@java.io.Serial
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
Map<Object,Object> copy = new HashMap<>();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,7 @@ package java.security;
*/
public class ProviderException extends RuntimeException {
@java.io.Serial
private static final long serialVersionUID = 5256023526693665674L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -55,5 +55,6 @@ public interface PublicKey extends Key {
*/
@Deprecated
@SuppressWarnings("serial")
@java.io.Serial
static final long serialVersionUID = 7187392471159151072L;
}

View file

@ -1032,6 +1032,7 @@ public class SecureRandom extends java.util.Random {
}
// Declare serialVersionUID to be compatible with JDK1.1
@java.io.Serial
static final long serialVersionUID = 4940670005562187L;
// Retain unused values serialized from JDK1.1

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -84,6 +84,7 @@ package java.security;
public abstract class SecureRandomSpi implements java.io.Serializable {
@java.io.Serial
private static final long serialVersionUID = -2991854161009191830L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -338,6 +338,7 @@ import java.util.StringTokenizer;
public final class SecurityPermission extends BasicPermission {
@java.io.Serial
private static final long serialVersionUID = 5236109936224050470L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,6 +34,7 @@ package java.security;
public class SignatureException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = 7509989324975124438L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -118,6 +118,7 @@ import java.io.*;
public final class SignedObject implements Serializable {
@java.io.Serial
private static final long serialVersionUID = 720502720485447167L;
/*
@ -250,6 +251,7 @@ public final class SignedObject implements Serializable {
* readObject is called to restore the state of the SignedObject from
* a stream.
*/
@java.io.Serial
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException {
java.io.ObjectInputStream.GetField fields = s.readFields();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -49,6 +49,7 @@ import java.io.*;
@SuppressWarnings("removal")
public abstract class Signer extends Identity {
@java.io.Serial
private static final long serialVersionUID = -1763464102261361480L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -44,6 +44,7 @@ import java.util.List;
public final class Timestamp implements Serializable {
@java.io.Serial
private static final long serialVersionUID = -5502683707821851294L;
/**
@ -155,6 +156,7 @@ public final class Timestamp implements Serializable {
}
// Explicitly reset hash code value to -1
@java.io.Serial
private void readObject(ObjectInputStream ois)
throws IOException, ClassNotFoundException {
ois.defaultReadObject();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,6 +34,7 @@ package java.security;
public class UnrecoverableEntryException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = -4527142945246286535L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,6 +34,7 @@ package java.security;
public class UnrecoverableKeyException extends UnrecoverableEntryException {
@java.io.Serial
private static final long serialVersionUID = 7275063078190151277L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -107,6 +107,7 @@ public final class UnresolvedPermission extends Permission
implements java.io.Serializable
{
@java.io.Serial
private static final long serialVersionUID = -4821973115467008846L;
private static final sun.security.util.Debug debug =
@ -521,6 +522,7 @@ implements java.io.Serializable
* followed by the certificate encoding itself which is written out as an
* array of bytes.
*/
@java.io.Serial
private void writeObject(java.io.ObjectOutputStream oos)
throws IOException
{
@ -549,6 +551,7 @@ implements java.io.Serializable
/**
* Restores this object from a stream (i.e., deserializes it).
*/
@java.io.Serial
private void readObject(java.io.ObjectInputStream ois)
throws IOException, ClassNotFoundException
{

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -137,6 +137,7 @@ implements java.io.Serializable
return Collections.enumeration(results);
}
@java.io.Serial
private static final long serialVersionUID = -7176153071733132400L;
// Need to maintain serialization interoperability with earlier releases,
@ -148,6 +149,7 @@ implements java.io.Serializable
* A table of the UnresolvedPermissions keyed on type, value is Vector
* of permissions
*/
@java.io.Serial
private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("permissions", Hashtable.class),
};
@ -160,6 +162,7 @@ implements java.io.Serializable
* in which the values are Vectors for
* serialization compatibility with earlier releases.
*/
@java.io.Serial
private void writeObject(ObjectOutputStream out) throws IOException {
// Don't call out.defaultWriteObject()
@ -188,6 +191,7 @@ implements java.io.Serializable
* Reads in a Hashtable in which the values are Vectors of
* UnresolvedPermissions and saves them in the perms field.
*/
@java.io.Serial
private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
// Don't call defaultReadObject()

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,6 +35,7 @@ import java.security.GeneralSecurityException;
*/
public class CRLException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = -6694728944094197147L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -119,6 +119,7 @@ import java.util.List;
*/
public abstract class CertPath implements Serializable {
@java.io.Serial
private static final long serialVersionUID = 6068470306649138683L;
private String type; // the type of certificates in this chain
@ -282,6 +283,7 @@ public abstract class CertPath implements Serializable {
* @throws ObjectStreamException if a {@code CertPathRep} object
* representing this certification path could not be created
*/
@java.io.Serial
protected Object writeReplace() throws ObjectStreamException {
try {
return new CertPathRep(type, getEncoded());
@ -300,6 +302,7 @@ public abstract class CertPath implements Serializable {
*/
protected static class CertPathRep implements Serializable {
@java.io.Serial
private static final long serialVersionUID = 3015633072427920915L;
/** The Certificate type */
@ -327,6 +330,7 @@ public abstract class CertPath implements Serializable {
* @throws ObjectStreamException if a {@code CertPath} could not
* be constructed
*/
@java.io.Serial
protected Object readResolve() throws ObjectStreamException {
try {
CertificateFactory cf = CertificateFactory.getInstance(type);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -50,6 +50,7 @@ import java.security.GeneralSecurityException;
*/
public class CertPathBuilderException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = 5316471420178794402L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -61,6 +61,7 @@ import java.security.GeneralSecurityException;
*/
public class CertPathValidatorException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = -3083180014971893139L;
/**
@ -228,6 +229,7 @@ public class CertPathValidatorException extends GeneralSecurityException {
return this.reason;
}
@java.io.Serial
private void readObject(ObjectInputStream stream)
throws ClassNotFoundException, IOException {
stream.defaultReadObject();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -50,6 +50,7 @@ import java.security.GeneralSecurityException;
*/
public class CertStoreException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = 2395296107471573245L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -62,6 +62,7 @@ import sun.security.x509.X509CertImpl;
public abstract class Certificate implements java.io.Serializable {
@java.io.Serial
private static final long serialVersionUID = -3585440601605666277L;
// the certificate type
@ -240,6 +241,7 @@ public abstract class Certificate implements java.io.Serializable {
*/
protected static class CertificateRep implements java.io.Serializable {
@java.io.Serial
private static final long serialVersionUID = -8563758940495660020L;
private String type;
@ -266,6 +268,7 @@ public abstract class Certificate implements java.io.Serializable {
* @throws java.io.ObjectStreamException if the Certificate
* could not be resolved
*/
@java.io.Serial
protected Object readResolve() throws java.io.ObjectStreamException {
try {
CertificateFactory cf = CertificateFactory.getInstance(type);
@ -290,6 +293,7 @@ public abstract class Certificate implements java.io.Serializable {
* this Certificate could not be created
* @since 1.3
*/
@java.io.Serial
protected Object writeReplace() throws java.io.ObjectStreamException {
try {
return new CertificateRep(type, getEncoded());

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,6 +34,7 @@ package java.security.cert;
*/
public class CertificateEncodingException extends CertificateException {
@java.io.Serial
private static final long serialVersionUID = 6219492851589449162L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,7 @@ import java.security.GeneralSecurityException;
*/
public class CertificateException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = 3192535253797119798L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,7 @@ package java.security.cert;
*/
public class CertificateExpiredException extends CertificateException {
@java.io.Serial
private static final long serialVersionUID = 9071001339691533771L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,7 @@ package java.security.cert;
*/
public class CertificateNotYetValidException extends CertificateException {
@java.io.Serial
static final long serialVersionUID = 4355919900041064702L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,6 +35,7 @@ package java.security.cert;
*/
public class CertificateParsingException extends CertificateException {
@java.io.Serial
private static final long serialVersionUID = -7989222416793322029L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -50,6 +50,7 @@ import sun.security.x509.InvalidityDateExtension;
*/
public class CertificateRevokedException extends CertificateException {
@java.io.Serial
private static final long serialVersionUID = 7839996631571608627L;
/**
@ -191,6 +192,7 @@ public class CertificateRevokedException extends CertificateException {
* flag (boolean), the length of the encoded extension value byte array
* (int), and the encoded extension value bytes.
*/
@java.io.Serial
private void writeObject(ObjectOutputStream oos) throws IOException {
// Write out the non-transient fields
// (revocationDate, reason, authority)
@ -217,6 +219,7 @@ public class CertificateRevokedException extends CertificateException {
/**
* Deserialize the {@code CertificateRevokedException} instance.
*/
@java.io.Serial
private void readObject(ObjectInputStream ois)
throws IOException, ClassNotFoundException {
// Read in the non-transient fields

View file

@ -108,6 +108,7 @@ import sun.security.util.SignatureUtil;
public abstract class X509Certificate extends Certificate
implements X509Extension {
@java.io.Serial
private static final long serialVersionUID = -2491127588187038216L;
private transient X500Principal subjectX500Principal, issuerX500Principal;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -53,6 +53,7 @@ public interface DSAPrivateKey extends DSAKey, java.security.PrivateKey {
*/
@Deprecated
@SuppressWarnings("serial")
@java.io.Serial
static final long serialVersionUID = 7776497482533790279L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -53,6 +53,7 @@ public interface DSAPublicKey extends DSAKey, java.security.PublicKey {
*/
@Deprecated
@SuppressWarnings("serial")
@java.io.Serial
static final long serialVersionUID = 1234526332779022332L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,6 +48,7 @@ public interface ECPrivateKey extends PrivateKey, ECKey {
*/
@Deprecated
@SuppressWarnings("serial")
@java.io.Serial
static final long serialVersionUID = -7896394956925609184L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -50,6 +50,7 @@ public interface ECPublicKey extends PublicKey, ECKey {
*/
@Deprecated
@SuppressWarnings("serial")
@java.io.Serial
static final long serialVersionUID = -3314988629879632826L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -56,6 +56,7 @@ public interface RSAMultiPrimePrivateCrtKey extends RSAPrivateKey {
*/
@Deprecated
@SuppressWarnings("serial")
@java.io.Serial
static final long serialVersionUID = 618058533534628008L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -51,6 +51,7 @@ public interface RSAPrivateCrtKey extends RSAPrivateKey {
*/
@Deprecated
@SuppressWarnings("serial")
@java.io.Serial
static final long serialVersionUID = -5682214253527700368L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -50,6 +50,7 @@ public interface RSAPrivateKey extends java.security.PrivateKey, RSAKey
*/
@Deprecated
@SuppressWarnings("serial")
@java.io.Serial
static final long serialVersionUID = 5187144804936595022L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -47,6 +47,7 @@ public interface RSAPublicKey extends java.security.PublicKey, RSAKey
*/
@Deprecated
@SuppressWarnings("serial")
@java.io.Serial
static final long serialVersionUID = -8727434096241101194L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,6 +40,7 @@ import java.security.GeneralSecurityException;
public class InvalidKeySpecException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = 3546139293998810778L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -42,6 +42,7 @@ import java.security.GeneralSecurityException;
public class InvalidParameterSpecException extends GeneralSecurityException {
@java.io.Serial
private static final long serialVersionUID = -970468769593399342L;
/**