< prev index next >

src/java.base/share/classes/java/util/Random.java

Print this page

        

@@ -74,10 +74,11 @@
  * @since   1.0
  */
 public
 class Random implements java.io.Serializable {
     /** use serialVersionUID from JDK 1.1 for interoperability */
+    @java.io.Serial
     static final long serialVersionUID = 3905348978240129619L;
 
     /**
      * The internal state associated with this pseudorandom number generator.
      * (The specs for the methods in this class describe the ongoing

@@ -1166,20 +1167,22 @@
      * @serialField    nextNextGaussian double
      *              next Gaussian to be returned
      * @serialField      haveNextNextGaussian boolean
      *              nextNextGaussian is valid
      */
+    @java.io.Serial
     private static final ObjectStreamField[] serialPersistentFields = {
         new ObjectStreamField("seed", Long.TYPE),
         new ObjectStreamField("nextNextGaussian", Double.TYPE),
         new ObjectStreamField("haveNextNextGaussian", Boolean.TYPE)
     };
 
     /**
      * Reconstitute the {@code Random} instance from a stream (that is,
      * deserialize it).
      */
+    @java.io.Serial
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException {
 
         ObjectInputStream.GetField fields = s.readFields();
 

@@ -1195,10 +1198,11 @@
     }
 
     /**
      * Save the {@code Random} instance to a stream.
      */
+    @java.io.Serial
     private synchronized void writeObject(ObjectOutputStream s)
         throws IOException {
 
         // set the values of the Serializable fields
         ObjectOutputStream.PutField fields = s.putFields();
< prev index next >