src/java.base/share/classes/java/text/MessageFormat.java
changeset 57956 e0b8b019d2f5
parent 54206 003cc64366da
child 58242 94bb65cb37d3
equal deleted inserted replaced
57955:18863bf3501f 57956:e0b8b019d2f5
   347  * @since 1.1
   347  * @since 1.1
   348  */
   348  */
   349 
   349 
   350 public class MessageFormat extends Format {
   350 public class MessageFormat extends Format {
   351 
   351 
       
   352     @java.io.Serial
   352     private static final long serialVersionUID = 6479157306784022952L;
   353     private static final long serialVersionUID = 6479157306784022952L;
   353 
   354 
   354     /**
   355     /**
   355      * Constructs a MessageFormat for the default
   356      * Constructs a MessageFormat for the default
   356      * {@link java.util.Locale.Category#FORMAT FORMAT} locale and the
   357      * {@link java.util.Locale.Category#FORMAT FORMAT} locale and the
  1151      * @since 1.4
  1152      * @since 1.4
  1152      */
  1153      */
  1153     public static class Field extends Format.Field {
  1154     public static class Field extends Format.Field {
  1154 
  1155 
  1155         // Proclaim serial compatibility with 1.4 FCS
  1156         // Proclaim serial compatibility with 1.4 FCS
       
  1157         @java.io.Serial
  1156         private static final long serialVersionUID = 7899943957617360810L;
  1158         private static final long serialVersionUID = 7899943957617360810L;
  1157 
  1159 
  1158         /**
  1160         /**
  1159          * Creates a Field with the specified name.
  1161          * Creates a Field with the specified name.
  1160          *
  1162          *
  1169          *
  1171          *
  1170          * @throws InvalidObjectException if the constant could not be
  1172          * @throws InvalidObjectException if the constant could not be
  1171          *         resolved.
  1173          *         resolved.
  1172          * @return resolved MessageFormat.Field constant
  1174          * @return resolved MessageFormat.Field constant
  1173          */
  1175          */
       
  1176         @java.io.Serial
  1174         protected Object readResolve() throws InvalidObjectException {
  1177         protected Object readResolve() throws InvalidObjectException {
  1175             if (this.getClass() != MessageFormat.Field.class) {
  1178             if (this.getClass() != MessageFormat.Field.class) {
  1176                 throw new InvalidObjectException("subclass didn't correctly implement readResolve");
  1179                 throw new InvalidObjectException("subclass didn't correctly implement readResolve");
  1177             }
  1180             }
  1178 
  1181 
  1599     /**
  1602     /**
  1600      * After reading an object from the input stream, do a simple verification
  1603      * After reading an object from the input stream, do a simple verification
  1601      * to maintain class invariants.
  1604      * to maintain class invariants.
  1602      * @throws InvalidObjectException if the objects read from the stream is invalid.
  1605      * @throws InvalidObjectException if the objects read from the stream is invalid.
  1603      */
  1606      */
       
  1607     @java.io.Serial
  1604     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  1608     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  1605         in.defaultReadObject();
  1609         in.defaultReadObject();
  1606         boolean isValid = maxOffset >= -1
  1610         boolean isValid = maxOffset >= -1
  1607                 && formats.length > maxOffset
  1611                 && formats.length > maxOffset
  1608                 && offsets.length > maxOffset
  1612                 && offsets.length > maxOffset