Sunday, 10 July 2016

java - What are the valid reasons for incrementing the version ID of a Serializable object definition?



What are the valid and invalid reasons for incrementing the version ID of a class definition that implements Serializable?



In other words what will introduce a write-then-read incompatibility? Is there any way that a change to a method can introduce an incompatibility? Is there any way refactoring can introduce an incompatibility?



Edit Reading the links and answers I see that the programmer defined ID is the way to take control of an automatic ID that makes objects too brittle. If I control the ID, then I need to know the exact rules for managing it.



Answer



From Oracle, the list of compatible and incompatible changes. To address the question, bumping the ID is unnecessary ("invalid") if the change is compatible and "valid" if the change is incompatible.


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...