Tuesday, 23 January 2018

java - what is a serial version id?

It has to do with Java serialization.



When the fields of a class changes, you can no longer unserialize other versions of the class. If you try, Java will throw an exception.



However sometimes the change in fields don't matter and you want to say "unserialize anyway." To do that, you define this serial number. Now Java will use that number rather than reflection to decide whether your class definition is "different."



Finally, you can get around all this by defining your own serialization functions, and indeed many advocates insist that you should.

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...