< prev index next >
src/java.base/share/classes/java/lang/invoke/MethodType.java
Print this page
*** 102,111 ****
--- 102,112 ----
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,1236 ****
--- 1228,1238 ----
/// 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,1258 ****
--- 1251,1261 ----
* 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,1277 ****
--- 1271,1281 ----
* @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,1316 ****
--- 1311,1321 ----
/**
* 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 >