src/java.base/share/classes/java/lang/StringBuffer.java
changeset 57956 e0b8b019d2f5
parent 54481 f847a42ddc01
equal deleted inserted replaced
57955:18863bf3501f 57956:e0b8b019d2f5
   113      * whenever the StringBuffer is modified.
   113      * whenever the StringBuffer is modified.
   114      */
   114      */
   115     private transient String toStringCache;
   115     private transient String toStringCache;
   116 
   116 
   117     /** use serialVersionUID from JDK 1.0.2 for interoperability */
   117     /** use serialVersionUID from JDK 1.0.2 for interoperability */
       
   118     @java.io.Serial
   118     static final long serialVersionUID = 3388685877147921107L;
   119     static final long serialVersionUID = 3388685877147921107L;
   119 
   120 
   120     /**
   121     /**
   121      * Constructs a string buffer with no characters in it and an
   122      * Constructs a string buffer with no characters in it and an
   122      * initial capacity of 16 characters.
   123      * initial capacity of 16 characters.
   721      *              The number of characters in this StringBuffer.
   722      *              The number of characters in this StringBuffer.
   722      * @serialField shared  boolean
   723      * @serialField shared  boolean
   723      *              A flag indicating whether the backing array is shared.
   724      *              A flag indicating whether the backing array is shared.
   724      *              The value is ignored upon deserialization.
   725      *              The value is ignored upon deserialization.
   725      */
   726      */
       
   727     @java.io.Serial
   726     private static final java.io.ObjectStreamField[] serialPersistentFields =
   728     private static final java.io.ObjectStreamField[] serialPersistentFields =
   727     {
   729     {
   728         new java.io.ObjectStreamField("value", char[].class),
   730         new java.io.ObjectStreamField("value", char[].class),
   729         new java.io.ObjectStreamField("count", Integer.TYPE),
   731         new java.io.ObjectStreamField("count", Integer.TYPE),
   730         new java.io.ObjectStreamField("shared", Boolean.TYPE),
   732         new java.io.ObjectStreamField("shared", Boolean.TYPE),
   732 
   734 
   733     /**
   735     /**
   734      * readObject is called to restore the state of the StringBuffer from
   736      * readObject is called to restore the state of the StringBuffer from
   735      * a stream.
   737      * a stream.
   736      */
   738      */
       
   739     @java.io.Serial
   737     private synchronized void writeObject(java.io.ObjectOutputStream s)
   740     private synchronized void writeObject(java.io.ObjectOutputStream s)
   738         throws java.io.IOException {
   741         throws java.io.IOException {
   739         java.io.ObjectOutputStream.PutField fields = s.putFields();
   742         java.io.ObjectOutputStream.PutField fields = s.putFields();
   740         char[] val = new char[capacity()];
   743         char[] val = new char[capacity()];
   741         if (isLatin1()) {
   744         if (isLatin1()) {
   751 
   754 
   752     /**
   755     /**
   753      * readObject is called to restore the state of the StringBuffer from
   756      * readObject is called to restore the state of the StringBuffer from
   754      * a stream.
   757      * a stream.
   755      */
   758      */
       
   759     @java.io.Serial
   756     private void readObject(java.io.ObjectInputStream s)
   760     private void readObject(java.io.ObjectInputStream s)
   757         throws java.io.IOException, ClassNotFoundException {
   761         throws java.io.IOException, ClassNotFoundException {
   758         java.io.ObjectInputStream.GetField fields = s.readFields();
   762         java.io.ObjectInputStream.GetField fields = s.readFields();
   759         char[] val = (char[])fields.get("value", null);
   763         char[] val = (char[])fields.get("value", null);
   760         initBytes(val, 0, val.length);
   764         initBytes(val, 0, val.length);