< prev index next >

src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2020, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -277,30 +277,43 @@
         } catch (NamingException e) {}
         return hash;
     }
 
     /**
-     * Overridden to avoid exposing implementation details.
-     * @serialData Default field (ignoreCase flag -- a boolean), followed by
+     * @serialData Default field (ignoreCase flag - a {@code boolean}), followed by
      * the number of attributes in the set
-     * (an int), and then the individual Attribute objects.
+     * (an {@code int}), and then the individual {@code Attribute} objects.
+     *
+     * @param s the {@code ObjectOutputStream} to write to
+     * @throws java.io.IOException if an I/O error occurs.
      */
+    @java.io.Serial
     private void writeObject(java.io.ObjectOutputStream s)
             throws java.io.IOException {
+        // Overridden to avoid exposing implementation details
         s.defaultWriteObject(); // write out the ignoreCase flag
         s.writeInt(attrs.size());
         Enumeration<Attribute> attrEnum = attrs.elements();
         while (attrEnum.hasMoreElements()) {
             s.writeObject(attrEnum.nextElement());
         }
     }
 
     /**
-     * Overridden to avoid exposing implementation details.
+     * Initializes the {@code BasicAttributes} from deserialized data.
+     *
+     * See {@code writeObject} for a description of the serial form.
+     *
+     * @param s the {@code ObjectInputStream} to read from
+     * @throws java.io.IOException if an I/O error occurs.
+     * @throws ClassNotFoundException if the class of a serialized object
+     *         could not be found.
      */
+    @java.io.Serial
     private void readObject(java.io.ObjectInputStream s)
             throws java.io.IOException, ClassNotFoundException {
+        // Overridden to avoid exposing implementation details.
         s.defaultReadObject();  // read in the ignoreCase flag
         int n = s.readInt();    // number of attributes
         attrs = (n >= 1)
                 ? new Hashtable<>(1 + (int) (Math.min(768, n) / .75f))
                 : new Hashtable<>(2); // can't have initial size of 0 (grrr...)
< prev index next >