A serializable class that uses the serialVersionUID field to act as an object version number must declare the field to be final, static, and of type long for it to be used by the Java serialization framework.

Make sure that the serialVersionUID field in a serialized class is final, static, and of type long.

In the following example, WrongNote defines serialVersionUID using the wrong type, so that it is not used by the Java serialization framework. However, Note defines it correctly so that it is used by the framework.

  • Java API Specification: Serializable.
  • JavaWorld: Ensure proper version control for serialized objects.