8229997: Apply java.io.Serial annotations in java.base

Reviewed-by: alanb, rriggs
This commit is contained in:
Joe Darcy 2019-08-29 16:31:34 -07:00
parent 6d064a747e
commit 9d764ee48e
315 changed files with 880 additions and 254 deletions

View file

@ -80,6 +80,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
implements Cloneable, java.io.Serializable
{
// declare EnumSet.class serialization compatibility with JDK 8
@java.io.Serial
private static final long serialVersionUID = 1009687484059888093L;
/**
@ -449,6 +450,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
* held by this proxy
*/
@SuppressWarnings("unchecked")
@java.io.Serial
private Object readResolve() {
// instead of cast to E, we should perhaps use elementType.cast()
// to avoid injection of forged stream, but it will slow the
@ -459,6 +461,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
return result;
}
@java.io.Serial
private static final long serialVersionUID = 362491234563181265L;
}
@ -471,6 +474,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
* @return a {@link SerializationProxy}
* representing the state of this instance
*/
@java.io.Serial
Object writeReplace() {
return new SerializationProxy<>(this);
}
@ -479,6 +483,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
* @param s the stream
* @throws java.io.InvalidObjectException always
*/
@java.io.Serial
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException {
throw new java.io.InvalidObjectException("Proxy required");