< prev index next >

src/java.base/share/classes/java/io/File.java

Print this page

        

@@ -2215,10 +2215,11 @@
      * The separator character is saved also so it can be replaced
      * in case the path is reconstituted on a different host type.
      *
      * @serialData  Default fields followed by separator character.
      */
+    @java.io.Serial
     private synchronized void writeObject(java.io.ObjectOutputStream s)
         throws IOException
     {
         s.defaultWriteObject();
         s.writeChar(separatorChar); // Add the separator character

@@ -2228,10 +2229,11 @@
      * readObject is called to restore this filename.
      * The original separator character is read.  If it is different
      * than the separator character on this system, then the old separator
      * is replaced by the local separator.
      */
+    @java.io.Serial
     private synchronized void readObject(java.io.ObjectInputStream s)
          throws IOException, ClassNotFoundException
     {
         ObjectInputStream.GetField fields = s.readFields();
         String pathField = (String)fields.get("path", null);

@@ -2249,10 +2251,11 @@
             = UNSAFE.objectFieldOffset(File.class, "path");
     private static final long PREFIX_LENGTH_OFFSET
             = UNSAFE.objectFieldOffset(File.class, "prefixLength");
 
     /** use serialVersionUID from JDK 1.0.2 for interoperability */
+    @java.io.Serial
     private static final long serialVersionUID = 301077366599181567L;
 
     // -- Integration with java.nio.file --
 
     private transient volatile Path filePath;
< prev index next >