src/java.base/share/classes/java/time/Duration.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 Duration ZERO = new Duration(0, 0);
   139     public static final Duration ZERO = new Duration(0, 0);
   140     /**
   140     /**
   141      * Serialization version.
   141      * Serialization version.
   142      */
   142      */
       
   143     @java.io.Serial
   143     private static final long serialVersionUID = 3078945930695997490L;
   144     private static final long serialVersionUID = 3078945930695997490L;
   144     /**
   145     /**
   145      * Constant for nanos per second.
   146      * Constant for nanos per second.
   146      */
   147      */
   147     private static final BigInteger BI_NANOS_PER_SECOND = BigInteger.valueOf(NANOS_PER_SECOND);
   148     private static final BigInteger BI_NANOS_PER_SECOND = BigInteger.valueOf(NANOS_PER_SECOND);
  1527      *  out.writeInt(nanos);
  1528      *  out.writeInt(nanos);
  1528      * </pre>
  1529      * </pre>
  1529      *
  1530      *
  1530      * @return the instance of {@code Ser}, not null
  1531      * @return the instance of {@code Ser}, not null
  1531      */
  1532      */
       
  1533     @java.io.Serial
  1532     private Object writeReplace() {
  1534     private Object writeReplace() {
  1533         return new Ser(Ser.DURATION_TYPE, this);
  1535         return new Ser(Ser.DURATION_TYPE, this);
  1534     }
  1536     }
  1535 
  1537 
  1536     /**
  1538     /**
  1537      * Defend against malicious streams.
  1539      * Defend against malicious streams.
  1538      *
  1540      *
  1539      * @param s the stream to read
  1541      * @param s the stream to read
  1540      * @throws InvalidObjectException always
  1542      * @throws InvalidObjectException always
  1541      */
  1543      */
       
  1544     @java.io.Serial
  1542     private void readObject(ObjectInputStream s) throws InvalidObjectException {
  1545     private void readObject(ObjectInputStream s) throws InvalidObjectException {
  1543         throw new InvalidObjectException("Deserialization via serialization delegate");
  1546         throw new InvalidObjectException("Deserialization via serialization delegate");
  1544     }
  1547     }
  1545 
  1548 
  1546     void writeExternal(DataOutput out) throws IOException {
  1549     void writeExternal(DataOutput out) throws IOException {