harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikhail Loenko <mloe...@gmail.com>
Subject [classlib] serialVersionUIDs for Serializable classes
Date Thu, 19 Jan 2006 08:59:46 GMT
Hello,

Do we need to have serialVersionUIDs for all Serializable classes even if those
fields are missing in API Spec or we might omit them?

According to Java Object Serialization Specification, 4.6
http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/class.html#4100

"It is strongly recommended that all serializable classes explicitly declare
serialVersionUID values, since the default serialVersionUID
computation is highly
sensitive to class details that may vary depending on compiler implementations,
and can thus result in unexpected serialVersionUID conflicts during
deserialization,
causing deserialization to fail"

I suggest to have these fields for all serialized classes, unless
there is a particular
reason for those classes not to have serialVersionUID

(And I'm not saying that we need them instead of serialization tests :)

Opinions?

Thanks,
Mikhail Loenko
Intel Middleware Products Division

Mime
View raw message