< prev index next >
src/java.base/share/classes/java/util/EnumSet.java
Print this page
*** 78,87 ****
--- 78,88 ----
*/
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;
/**
* The class of all the elements of this set.
*/
*** 447,466 ****
--- 448,469 ----
*
* @return a {@code EnumSet} object with initial state
* 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
// implementation
EnumSet<E> result = EnumSet.noneOf(elementType);
for (Enum<?> e : elements)
result.add((E)e);
return result;
}
+ @java.io.Serial
private static final long serialVersionUID = 362491234563181265L;
}
/**
* Returns a
*** 469,486 ****
--- 472,491 ----
* representing the state of this instance.
*
* @return a {@link SerializationProxy}
* representing the state of this instance
*/
+ @java.io.Serial
Object writeReplace() {
return new SerializationProxy<>(this);
}
/**
* @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");
}
}
< prev index next >