writeObject
, readObject
, readObjectNoData
,
writeExternal
, readExternal
, serialPersistentFields
)
defined in record classes. These members are ignored during serialization/deserialization of records.
record R1() implements Serializable {
@Serial
private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[0]; //The field is ignored during record serialization
@Serial
private void writeObject(ObjectOutputStream out) throws IOException { //The method is ignored during record serialization
}
}
record R2() implements Externalizable {
@Override
public void writeExternal(ObjectOutput out) throws IOException { //The method is ignored during record serialization
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { //The method is ignored during record serialization
}
}
This inspection only applies to language level 14 or higher.
New in 2020.3