|
Serialization Changes and Enhancements |
Documentation Contents |
The following are enhancements to serialization in Java 2 Platform Standard Edition 5.0. For a summary of enhancements in previous releases, see Enhancements in Previous Releases.
- Support for serialization of enumerated type instances
- Support has been added to serialization to handle enumerated types, which are new in version 5.0. The rules for serializing an enum instance differ from those for serializing an "ordinary" serializable object: the serialized form of an enum instance consists only of its enum constant name, along with information identifying its base enum type. Deserialization behavior differs as well--the class information is used to find the appropriate enum class, and the
Enum.valueOfmethod is called with that class and the received constant name in order to obtain the enum constant to return.
- Bug fix: java.io.StreamCorruptedException thrown due to java.lang.ClassNotFoundException
- In previous releases starting with version 1.4.0, a
ClassNotFoundExceptionthrown by theObjectInputStream.readClassDescriptormethod would be reflected to the top-level caller ofObjectInputStream.readObjectas aStreamCorruptedExceptionwith an empty cause. It is now reflected to the top-level caller as anInvalidClassExceptionwith the originalClassNotFoundExceptionas the cause.
- Bug fix: thread waiting on a java.io.ObjectStreamClass$EntryFuture for notification from [sic]
- In previous releases starting with version 1.4.0, the
ObjectStreamClass.lookupmethod could deadlock if called from within the static initializer of the class represented by the method'sClassargument. Deadlock should no longer occur in this case.
- Bug fix: no spec for serialVersionUID
- The javadoc for the
Serializableinterface has been expanded to more completely specify the role and usage ofserialVersionUIDs, and to emphasize the need to specify explicitserialVersionUIDs for serializable classes.
| Copyright ©
2004 Sun Microsystems, Inc. All Rights
Reserved.
Please send comments to: rmi-comments@java.sun.com |