< prev index next >

src/java.base/share/classes/java/lang/invoke/MethodType.java

Print this page

        

@@ -102,10 +102,11 @@
 public final
 class MethodType
         implements Constable,
                    TypeDescriptor.OfMethod<Class<?>, MethodType>,
                    java.io.Serializable {
+    @java.io.Serial
     private static final long serialVersionUID = 292L;  // {rtype, {ptype...}}
 
     // The rtype and ptypes fields define the structural identity of the method type:
     private final @Stable Class<?>   rtype;
     private final @Stable Class<?>[] ptypes;

@@ -1227,10 +1228,11 @@
     /// Serialization.
 
     /**
      * There are no serializable fields for {@code MethodType}.
      */
+    @java.io.Serial
     private static final java.io.ObjectStreamField[] serialPersistentFields = { };
 
     /**
      * Save the {@code MethodType} instance to a stream.
      *

@@ -1249,10 +1251,11 @@
      * For example, null values, or {@code void} parameter types,
      * will lead to exceptions during deserialization.
      * @param s the stream to write the object to
      * @throws java.io.IOException if there is a problem writing the object
      */
+    @java.io.Serial
     private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
         s.defaultWriteObject();  // requires serialPersistentFields to be an empty array
         s.writeObject(returnType());
         s.writeObject(parameterArray());
     }

@@ -1268,10 +1271,11 @@
      * @throws java.io.IOException if there is a problem reading the object
      * @throws ClassNotFoundException if one of the component classes cannot be resolved
      * @see #readResolve
      * @see #writeObject
      */
+    @java.io.Serial
     private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
         // Assign temporary defaults in case this object escapes
         MethodType_init(void.class, NO_PTYPES);
 
         s.defaultReadObject();  // requires serialPersistentFields to be an empty array

@@ -1307,10 +1311,11 @@
     /**
      * Resolves and initializes a {@code MethodType} object
      * after serialization.
      * @return the fully initialized {@code MethodType} object
      */
+    @java.io.Serial
     private Object readResolve() {
         // Do not use a trusted path for deserialization:
         //    return makeImpl(rtype, ptypes, true);
         // Verify all operands, and make sure ptypes is unshared:
         try {
< prev index next >