FYI: ObjectStream fix for shadowed fields
Mark Wielaard
mark@klomp.org
Fri Mar 14 11:50:00 GMT 2003
Hi,
Jeroen his paperwork came through so I am applying this patch to branch
and mainline (and Classpath if subversions.gnu.org ever completes a CVS
update...). It cleans up the code a little bit and more importantly it
fixes the bug (shown by Mauve and seen in actual code) we had when a
class was shadowing a private field of one of the super classes.
2003-03-14 Jeroen Frijters <jeroen@sumatra.nl>
* java/io/ObjectInputStream.java (readObject): Cleaned up the class
hierarchy loop.
(readFields(Object,ObjectStreamField[],boolean)): Changed argument
list to Object,ObjectStreamClass, moved callReadMethod code up into
readObject and added Class argument to all setXxxField calls.
(callReadMethod): Changed Class argument to ObjectStreamClass to be
consistent with ObjectOutputStream and to facilitate caching the
Method in the future.
(setBooleanField): Added Class argument.
(setByteField): Likewise.
(setCharField): Likewise.
(setDoubleField): Likewise.
(setFloatField): Likewise.
(setIntField): Likewise.
(setLongField): Likewise.
(setShortField): Likewise.
(setObjectField): Likewise.
* java/io/ObjectOutputStream.java (writeObject): Cleaned up the
class hierarchy loop.
(defaultWriteObject): Call writeFields with new argument list.
(writeFields(Object,ObjectStreamField[],boolean): Changed argument
list to Object,ObjectStreamClass, moved callWriteMethod up into
writeObject and added Class argument to all getXxxField calls.
(callWriteMethod): Added ObjectStreamClass argument to be able to
get the proper class to call getMethod on (each class can have (or
not have) its own writeObject method).
(getBooleanField): Added Class argument.
(getByteField): Likewise.
(getCharField): Likewise.
(getDoubleField): Likewise.
(getFloatField): Likewise.
(getIntField): Likewise.
(getLongField): Likewise.
(getShortField): Likewise.
(getObjectField): Likewise.
* java/io/ObjectStreamClass.java (hasReadMethod): Added method to
facilitate caching the Method object in the future.
Cheers,
Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ObjectStream.patch
Type: text/x-patch
Size: 17688 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20030314/9c7f561b/attachment.bin>
More information about the Java-patches
mailing list