< prev index next >

src/java.base/share/classes/java/net/InetAddress.java

Print this page

        

@@ -297,10 +297,11 @@
      * Lazily initialized via a data race; safe because Strings are immutable.
      */
     private transient String canonicalHostName = null;
 
     /** use serialVersionUID from JDK 1.0.2 for interoperability */
+    @java.io.Serial
     private static final long serialVersionUID = 3286316764910316507L;
 
     /*
      * Load net library into runtime, and perform initializations.
      */

@@ -351,10 +352,11 @@
      * @return the alternate object to the de-serialized object.
      *
      * @throws ObjectStreamException if a new object replacing this
      * object could not be created
      */
+    @java.io.Serial
     private Object readResolve() throws ObjectStreamException {
         // will replace the deserialized 'this' object
         return new Inet4Address(holder().getHostName(), holder().getAddress());
     }
 

@@ -1685,10 +1687,11 @@
         }
 
         return (InetAddressImpl) impl;
     }
 
+    @java.io.Serial
     private void readObjectNoData () {
         if (getClass().getClassLoader() != null) {
             throw new SecurityException ("invalid address type");
         }
     }

@@ -1696,10 +1699,11 @@
     private static final jdk.internal.misc.Unsafe UNSAFE
             = jdk.internal.misc.Unsafe.getUnsafe();
     private static final long FIELDS_OFFSET
             = UNSAFE.objectFieldOffset(InetAddress.class, "holder");
 
+    @java.io.Serial
     private void readObject (ObjectInputStream s) throws
                          IOException, ClassNotFoundException {
         if (getClass().getClassLoader() != null) {
             throw new SecurityException ("invalid address type");
         }

@@ -1719,16 +1723,18 @@
     /**
      * @serialField hostName String
      * @serialField address int
      * @serialField family int
      */
+    @java.io.Serial
     private static final ObjectStreamField[] serialPersistentFields = {
         new ObjectStreamField("hostName", String.class),
         new ObjectStreamField("address", int.class),
         new ObjectStreamField("family", int.class),
     };
 
+    @java.io.Serial
     private void writeObject (ObjectOutputStream s) throws
                         IOException {
         if (getClass().getClassLoader() != null) {
             throw new SecurityException ("invalid address type");
         }
< prev index next >