Ahti Kitsik
Building develper tools. Python, Java, JavaScript.

writings about @ahtik

Reason to serialVersionUID your serializable classes

By Ahti Kitsik, 23 Aug 2006

Quoting Eclipse FAQ: "When classes compiled in Eclipse are written to an object stream, you may not be able to read them back in a program that was compiled elsewhere. Many people blame this on the Eclipse compiler, assuming that it is somehow not conforming properly to spec. In fact, this can be a problem between any two compilers or even two versions of a compiler provided by the same vendor. If you need object serialization, the only way to be safe is to explicitly define the serialVersionUID in your code! /.../ Bottom line: Always define the serialVersionUID explicitly in your source files."

My question is: can there be an audit to automatically detect source files where you explicitly defined serialVersionUID that is out of date? A nice-to-have addition would be a quick-fix for repairing serialVersionUID. Current eclipse quick-fix supports only generating serialVersionUID from scratch.

@ahtik is on twitter!