src/java.base/share/classes/java/util/EnumSet.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 52887 0d89f672c62e
child 58679 9c3209ff7550
--- a/src/java.base/share/classes/java/util/EnumSet.java	Thu Oct 17 20:27:44 2019 +0100
+++ b/src/java.base/share/classes/java/util/EnumSet.java	Thu Oct 17 20:53:35 2019 +0100
@@ -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
@@ -76,11 +76,13 @@
  * @since 1.5
  * @see EnumMap
  */
-@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
 {
+    // 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.
      */
@@ -448,6 +450,7 @@
          * 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
@@ -458,6 +461,7 @@
             return result;
         }
 
+        @java.io.Serial
         private static final long serialVersionUID = 362491234563181265L;
     }
 
@@ -470,6 +474,7 @@
      * @return a {@link SerializationProxy}
      * representing the state of this instance
      */
+    @java.io.Serial
     Object writeReplace() {
         return new SerializationProxy<>(this);
     }
@@ -478,6 +483,7 @@
      * @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");