What are the compatible and incompatible changes when dealing with versioned serialized objects?
Location: http://www.jguru.com/faq/view.jsp?EID=5064 Created: Jan 15, 2000 Author: Govind Seshadri (http://www.jguru.com/guru/viewbio.jsp?EID=14) If a newer version of a serialized object has to be compatible with an older version, it is important that the newer version abides by the rules for compatible and incompatible changes. A compatible change is one that can be made to a new version of the class, which still keeps the stream compatible with older versions of the class. Examples of compatible changes are: • Addition of new fields or classes does not affect serialization, as any new data in the stream is simply ignored by older versions. When the instance of an older version of the class is deserialized, the newly added field will be set to its default value. • You can field change access modifiers like private, public, protected or package as they are not reflected to the serial stream. • You can change a transient or static field to a non-transient or non-static field, as it is