SerialVersionUID no longer required from Java 5 onwards?

The JavaDocs for Java 5 still states that it is needed.

The JavaDocs for Java 5 still states that it is needed: If a serializable class does not explicitly declare a serialVersionUID, then the serialization runtime will calculate a default serialVersionUID value for that class based on various aspects of the class, as described in the Java(TM) Object Serialization Specification. However, 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 InvalidClassExceptions during deserialization. Therefore, to guarantee a consistent serialVersionUID value across different java compiler implementations, a serializable class must declare an explicit serialVersionUID value.It is also strongly advised that explicit serialVersionUID declarations use the private modifier where possible, since such declarations apply only to the immediately declaring class--serialVersionUID fields are not useful as inherited members.

4 Even the Java 7 docs have the same disclaimer. – Joachim Sauer Sep 12 at 8:29.

Since Java 1.4 you have been able to use XMLEncoder for Serialisation and this ignores any serialVersionUID, as does most other serialisation libraries. However if you use ObjectOutputStream, its usage of serialVersionUID has not changed.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions