< prev index next >

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

Print this page

        

*** 297,306 **** --- 297,307 ---- * 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,360 **** --- 352,362 ---- * @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,1694 **** --- 1687,1697 ---- } return (InetAddressImpl) impl; } + @java.io.Serial private void readObjectNoData () { if (getClass().getClassLoader() != null) { throw new SecurityException ("invalid address type"); } }
*** 1696,1705 **** --- 1699,1709 ---- 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,1734 **** --- 1723,1740 ---- /** * @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 >