Questions tagged [serialversionuid]

`serialVersionUID` is an optional attribute of Java classes to indicate the standard serialization/deserialization format version. Used to detect if a serialized object is incompatible with the deserialization process/class.

Documented in java.io.Serializable:

The serialization runtime associates with each serializable class a version number, called a serialVersionUID, which is used during deserialization to verify that the sender and receiver of a serialized object have loaded classes for that object that are compatible with respect to serialization. If the receiver has loaded a class for the object that has a different serialVersionUID than that of the corresponding sender's class, then deserialization will result in an InvalidClassException. A serializable class can declare its own serialVersionUID explicitly by declaring a field named "serialVersionUID" that must be static, final, and of type long:

ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;
122 questions
-3
votes
2 answers

Is there any relationship between transient & volatile variables and serial version uid?

Actually I want to know about the concept of serialization and in what way that the transient&local variables are related to serialversionuid and how the serialization is actually happening?
-3
votes
2 answers

Serialization : InvalidClassException scala

Why am I getting this error? Serialization Problem java.io.InvalidClassException: scala.reflect.ClassTypeManifest; local class incompatible: stream classdesc serialVersionUID = using intellij
igx
  • 4,101
  • 11
  • 43
  • 88
1 2 3
8
9