I know that I can use serialVersionUID to control the version of classes. And I read that I can then add or remove fields and the class will still be compatible, it will just use default values.
When must I change the serialVersionUID?
I know that I can use serialVersionUID to control the version of classes. And I read that I can then add or remove fields and the class will still be compatible, it will just use default values.
When must I change the serialVersionUID?
For the sake of completeness, here's a list of changes that break the compatibility of Java serialization according to the java 8 spec:
To declare your own serialVersionUID in java, type this in the serialized object class:
@Serial
private static final long serialVersionUID = desired_number;