< prev index next >

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

Print this page

        

@@ -173,10 +173,11 @@
  * @since 1.0
  */
 public final class URL implements java.io.Serializable {
 
     static final String BUILTIN_HANDLERS_PREFIX = "sun.net.www.protocol";
+    @java.io.Serial
     static final long serialVersionUID = -7627629688361524110L;
 
     /**
      * The property which specifies the package prefix list to be scanned
      * for protocol handlers.  The value of this property (if any) should

@@ -1487,10 +1488,11 @@
      * @serialField    ref String
      *
      * @serialField    hashCode int
      *
      */
+    @java.io.Serial
     private static final ObjectStreamField[] serialPersistentFields = {
         new ObjectStreamField("protocol", String.class),
         new ObjectStreamField("host", String.class),
         new ObjectStreamField("port", int.class),
         new ObjectStreamField("authority", String.class),

@@ -1506,10 +1508,11 @@
      * @serialData the default write object value. When read back in,
      * the reader must ensure that calling getURLStreamHandler with
      * the protocol variable returns a valid URLStreamHandler and
      * throw an IOException if it does not.
      */
+    @java.io.Serial
     private synchronized void writeObject(java.io.ObjectOutputStream s)
         throws IOException
     {
         s.defaultWriteObject(); // write the fields
     }

@@ -1517,10 +1520,11 @@
     /**
      * readObject is called to restore the state of the URL from the
      * stream.  It reads the components of the URL and finds the local
      * stream handler.
      */
+    @java.io.Serial
     private synchronized void readObject(java.io.ObjectInputStream s)
             throws IOException, ClassNotFoundException {
         GetField gf = s.readFields();
         String protocol = (String)gf.get("protocol", null);
         if (getURLStreamHandler(protocol) == null) {

@@ -1548,11 +1552,11 @@
      * @return a newly created object from deserialized data
      *
      * @throws ObjectStreamException if a new object replacing this
      * object could not be created
      */
-
+   @java.io.Serial
    private Object readResolve() throws ObjectStreamException {
 
         URLStreamHandler handler = null;
         // already been checked in readObject
         handler = getURLStreamHandler(tempState.getProtocol());
< prev index next >