What happens if you take an old serializable object that never had serialVersionUID explicitly specified, and add serialVersionUID to that object? It seems to me that the next time the app was updated by endusers it would try to deserialize data from disc, find out that the serialVersionUID didn't match, overwrite the data with new data from the server/db/whatever and after that you're fine. Am I correct in this assumption? Are there further issues I should be wary of in doing this?
private class X implements serializable {...
private static final long serialVersionUID = 0L;
serialver
tool on the class as it is now, nothing happens.InvalidClassException
.It seems to me that the next time the app was updated by endusers it would try to deserialize data from disc
Correct.
find out that the serialVersionUID didn't match
Only if it really didn't match. If you follow the advice above, it will match.
overwrite the data with new data from the server/db/whatever
Incorrect. See above.
and after that you're fine.
No.
Am I correct in this assumption?
No.