axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <j...@cogentlogic.com>
Subject Re: serialVersionUID?
Date Wed, 20 Jul 2005 07:49:12 GMT
It's not a problem we need to worry about, Dan because XML decouples
different systems.

When a serialVersionUID is not provided for a class, the Java subsystem
generates one based upon the class content. Hence, when the content changes,
e.g. by adding a field, the auto-generated serialVersionUID changes. This
tells Java's serialization mechanism that different versions of the same
class are not compatible. By providing your own serialVersionUID for a class
you can ensure that new versions of a class are compatible with older
versions by retaining all the original fields (even if there are some you no
longer use) and by initializing new fields (so that deserialization from old
classes to new classes still works). This becomes fraught when dealing with
obfuscation and nested classes. Another source of potential problems arises
when dealing with classes that serialize/deserialize across networks, as in
RMI. Thankfully, web services eliminate these problems because we never
.serialize/deserialize classes across networks, we just pass XML. Hence, so
long as XML Schemas are in synch. between different systems, we can forget
about serialVersionUID.


Jeff Lawson



----- Original Message ----- 
From: "Kador, Daniel" <daniel.kador@lmco.com>
To: <axis-user@ws.apache.org>
Sent: Tuesday, July 19, 2005 3:30 PM
Subject: serialVersionUID?


> Hi,
>
> I've noticed that Axis-generated classes don't have a private static
> final long serialVersionUID member.  This isn't an error, but Eclipse
> reports it with a compile warning.  I've researched a little and found
> out that having this member is not required, but is highly recommended
> to ensure interopability while serializing on different platforms.
>
> I'd like to get rid of the warnings.  Eclipse will generate it for me,
> but I have well over 100 classes with this problem, so it'd be great if
> I could find an automatic fix.
>
> Thanks,
> Dan
>
>


Mime
View raw message