Serialization - wasn't using serialVersionUID.....

Hey all. I have a bit of a pickle. I have some objects that implement serialization. The class description hasn't changed for a very long time and I'm currently not having any problems with them. They do not implement a serialVersionUID.

I thought I read somewhere that different JVM implementations may see my class and serialization stream differently causing the objects to no longer be able to be de-serialized.

I'm opening up my app to a wider audience and want to implement the serialVersionUID but doing so will screw the current users of the objects. Not doing so may screw future users of the objects.

Any thoughts?

Thanks

ST

[674 byte] By [souLTowera] at [2007-11-26 21:03:22]
# 1

The JDK provides the [url=http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/serialver.html]serialver[/url] tool, which will tell you the default serialVersionUID value.

Of course, you should verify that you can serialize an object without explicit UID, add the UID that serialver gives you, and properly deserialize.

And note that different JVMs may (in my experience, do) have different default calculations for serialVersionUID.

kdgregorya at 2007-7-10 2:35:52 > top of Java-index,Java Essentials,Java Programming...
# 2
Surprising if true. It's pretty well specified: http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/class.html#4100I've known GNU java to get this wrong but then who cares?
ejpa at 2007-7-10 2:35:52 > top of Java-index,Java Essentials,Java Programming...