src/java.base/share/classes/java/time/Period.java
changeset 57956 e0b8b019d2f5
parent 52078 4a63197816ce
equal deleted inserted replaced
57955:18863bf3501f 57956:e0b8b019d2f5
     1 /*
     1 /*
     2  * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   138      */
   138      */
   139     public static final Period ZERO = new Period(0, 0, 0);
   139     public static final Period ZERO = new Period(0, 0, 0);
   140     /**
   140     /**
   141      * Serialization version.
   141      * Serialization version.
   142      */
   142      */
       
   143     @java.io.Serial
   143     private static final long serialVersionUID = -3587258372562876L;
   144     private static final long serialVersionUID = -3587258372562876L;
   144     /**
   145     /**
   145      * The pattern for parsing.
   146      * The pattern for parsing.
   146      */
   147      */
   147     private static final Pattern PATTERN =
   148     private static final Pattern PATTERN =
  1050      *  out.writeInt(days);
  1051      *  out.writeInt(days);
  1051      * </pre>
  1052      * </pre>
  1052      *
  1053      *
  1053      * @return the instance of {@code Ser}, not null
  1054      * @return the instance of {@code Ser}, not null
  1054      */
  1055      */
       
  1056     @java.io.Serial
  1055     private Object writeReplace() {
  1057     private Object writeReplace() {
  1056         return new Ser(Ser.PERIOD_TYPE, this);
  1058         return new Ser(Ser.PERIOD_TYPE, this);
  1057     }
  1059     }
  1058 
  1060 
  1059     /**
  1061     /**
  1060      * Defend against malicious streams.
  1062      * Defend against malicious streams.
  1061      *
  1063      *
  1062      * @param s the stream to read
  1064      * @param s the stream to read
  1063      * @throws java.io.InvalidObjectException always
  1065      * @throws java.io.InvalidObjectException always
  1064      */
  1066      */
       
  1067     @java.io.Serial
  1065     private void readObject(ObjectInputStream s) throws InvalidObjectException {
  1068     private void readObject(ObjectInputStream s) throws InvalidObjectException {
  1066         throw new InvalidObjectException("Deserialization via serialization delegate");
  1069         throw new InvalidObjectException("Deserialization via serialization delegate");
  1067     }
  1070     }
  1068 
  1071 
  1069     void writeExternal(DataOutput out) throws IOException {
  1072     void writeExternal(DataOutput out) throws IOException {