This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Ravi, This is an optional compilation check in Eclipse 3.1. While you could turn it off, I think you would be better served to add the constant. You can add it by running the serialver tool at the command line. Some plugins allow you to right click the message to generate the id as well. I don't recall whether Eclipse does by default.
[edited to add that I'm discussing message #1] [ March 03, 2005: Message edited by: Jeanne Boyarsky ]
The static member variable called serialVersionUID can be included in the code of the new class version that implements a compatible modification. So, all objects serialized by the original class are compatible with the new class.
There they say a versioned class must declare something like this: private static final long serialVersionUID = 3487495895819393L;
My question is will adding a constant like this have any problems viz. different JVM"s ? We run our code on different platforms
author & internet detective
Ravi, In that case, you are actually better off having the serialVersionUID explicitly stated. If you do not have it, the JVM has to calculate one. Aside from taking time, this introduces the [slight] risk that the platforms will calculate it different ways.
In other words using the serialVersionUID will make your code faster and more uniform across platforms.