< prev index next >

src/java.base/share/classes/java/util/EnumSet.java

Print this page
rev 13463 : 8148044: Remove Enum[0] constants from EnumSet and EnumMap
Reviewed-by: TBD

*** 75,86 **** * @author Josh Bloch * @since 1.5 * @see EnumMap * @serial exclude */ - @SuppressWarnings("serial") // No serialVersionUID due to usage of - // serial proxy pattern public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E> implements Cloneable, java.io.Serializable { /** * The class of all the elements of this set. --- 75,84 ----
*** 90,101 **** /** * All of the values comprising T. (Cached for performance.) */ final Enum<?>[] universe; - private static Enum<?>[] ZERO_LENGTH_ENUM_ARRAY = new Enum<?>[0]; - EnumSet(Class<E>elementType, Enum<?>[] universe) { this.elementType = elementType; this.universe = universe; } --- 88,97 ----
*** 419,428 **** --- 415,427 ---- * @serial include */ private static class SerializationProxy <E extends Enum<E>> implements java.io.Serializable { + + private static final Enum<?>[] ZERO_LENGTH_ENUM_ARRAY = new Enum<?>[0]; + /** * The element type of this enum set. * * @serial */
*** 455,464 **** --- 454,465 ---- Object writeReplace() { return new SerializationProxy<>(this); } + private static final long serialVersionUID = 1009687484059888093L; + // readObject method for the serialization proxy pattern // See Effective Java, Second Ed., Item 78. private void readObject(java.io.ObjectInputStream stream) throws java.io.InvalidObjectException { throw new java.io.InvalidObjectException("Proxy required");
< prev index next >