| # Serialization Changes and Enhancements in J2SE TM 5.0 | 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.valueOf` method 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 `ClassNotFoundException` thrown by the `ObjectInputStream.readClassDescriptor` method would be reflected to the top-level caller of `ObjectInputStream.readObject` as a `StreamCorruptedException` with an empty cause. It is now reflected to the top-level caller as an `InvalidClassException` with the original `ClassNotFoundException` as 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.lookup` method could deadlock if called from within the static initializer of the class represented by the method's `Class` argument. Deadlock should no longer occur in this case.

> Bug fix: no spec for serialVersionUID
>   The javadoc for the `Serializable` interface has been expanded to more completely specify the role and usage of `serialVersionUID`s, and to emphasize the need to specify explicit `serialVersionUID`s for serializable classes.

Copyright © 2004 Sun Microsystems, Inc. All Rights Reserved. Please send comments to: rmi-comments@java.sun.com |