< prev index next >

src/java.base/share/classes/java/lang/StringBuffer.java

Print this page

        

@@ -113,10 +113,11 @@
      * whenever the StringBuffer is modified.
      */
     private transient String toStringCache;
 
     /** use serialVersionUID from JDK 1.0.2 for interoperability */
+    @java.io.Serial
     static final long serialVersionUID = 3388685877147921107L;
 
     /**
      * Constructs a string buffer with no characters in it and an
      * initial capacity of 16 characters.

@@ -721,10 +722,11 @@
      *              The number of characters in this StringBuffer.
      * @serialField shared  boolean
      *              A flag indicating whether the backing array is shared.
      *              The value is ignored upon deserialization.
      */
+    @java.io.Serial
     private static final java.io.ObjectStreamField[] serialPersistentFields =
     {
         new java.io.ObjectStreamField("value", char[].class),
         new java.io.ObjectStreamField("count", Integer.TYPE),
         new java.io.ObjectStreamField("shared", Boolean.TYPE),

@@ -732,10 +734,11 @@
 
     /**
      * readObject is called to restore the state of the StringBuffer from
      * a stream.
      */
+    @java.io.Serial
     private synchronized void writeObject(java.io.ObjectOutputStream s)
         throws java.io.IOException {
         java.io.ObjectOutputStream.PutField fields = s.putFields();
         char[] val = new char[capacity()];
         if (isLatin1()) {

@@ -751,10 +754,11 @@
 
     /**
      * readObject is called to restore the state of the StringBuffer from
      * a stream.
      */
+    @java.io.Serial
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException {
         java.io.ObjectInputStream.GetField fields = s.readFields();
         char[] val = (char[])fields.get("value", null);
         initBytes(val, 0, val.length);
< prev index next >