SerialVersionUID… why bothering?
February 25, 2009 – 12:58 pm by Alessio SOLDANO“The Foo class does not declare a static final serialVersionUID field of type long“
Why bothering adding that field? What value should it be given? Should it be ever updated? If yes, when?
Junior java developer often underestimate this warning…I know because it happened to me too in the past
Well, before finding out (perhaps in QA phase) that the great new version of your software can not communicate with previous ones… spend some minutes reading the following pages:
- http://java.sun.com/developer/technicalArticles/Programming/serialization/ (especially “Version control” section at the end)
- http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/serialTOC.html (especially Chapter 5)
Finally… always declare the serialVersionUID when required… it can save you from issues in the future












