Java Serialization and the serialVersionUID Property

Categories: Java

Java’s object serialization feature identifies compatible versions of the same class using a “serial version id”. This can be computed by the JVM at runtime, or can be manually specified at compile-time by the developer via a field named serialVersionUID.

The Eclipse IDE by default shows a compile warning for classes marked Serializable which do not have an explicit serialVersionUID. This gets my vote for the dumbest compiler warning ever; in most cases using the default value is better than specifying one manually. See this page on Java Serialization and the serialVersionUID for more information.