-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.4.0
-
Fix Understood
-
generic
-
generic
A little-known "feature" of serialization's writeReplace/readResolve
functionality is that a subclass of a serialization class that defines
writeReplace and/or readResolve can in effect negate the superclass'
intended replacement behavior by defining its own writeReplace/readResolve
method which returns a reference to "this".
In light of this, designers of serializable classes which use writeReplace or
readResolve must be prepared for the possibility that the class may be
serialized without replacement, despite the presence of a writeReplace
or readResolve method.
functionality is that a subclass of a serialization class that defines
writeReplace and/or readResolve can in effect negate the superclass'
intended replacement behavior by defining its own writeReplace/readResolve
method which returns a reference to "this".
In light of this, designers of serializable classes which use writeReplace or
readResolve must be prepared for the possibility that the class may be
serialized without replacement, despite the presence of a writeReplace
or readResolve method.