This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
Re: Patch: Code to dump serialized objects
- To: Warren Levy <warrenl at cygnus dot com>
- Subject: Re: Patch: Code to dump serialized objects
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Fri, 03 Nov 2000 21:27:08 +1300
- CC: Java Patch List <java-patches at sourceware dot cygnus dot com>, classpath at gnu dot org
- References: <Pine.LNX.4.10.10011022343150.4788-100000@fencer.cygnus.com>
Warren Levy wrote:
> Folks,
> I've instrumented java.io.ObjectInputStream to work as a serialized object
> dumper by reworking the commented out debug statements in the module.
>
> Now, if you've configured with --enable-libgcj-debug and call the static
> method java.io.ObjectInputStream.setDump(true); you will see the contents
> of the serialized object printed out for you as it is deserialized with
> readObject(). This can be useful if you are trying to implement
> serialization for a special case class and you're trying to understand
> the (sometimes limited) Serialized Form doc better.
>
> I've made the code conditionally compiled this way to optimize things a
> little bit and to avoid this accidently being turned on in production
> code. Enjoy!
Hi Warren,
This sounds cool! However, since we're trying to create a _compatible_ Java implementation, adding new public methods to the
standard classes is a bad idea!
Instead, I would suggest that this stuff gets activated via a system property (eg "gcj.dumpobjects") that can be set either by
calling "System.setProperty()" or by using the -D option at compile-time.
Even better, why not make a small utility (ala 'jcf-dump') that hooks into ObjectInputStream and gets installed with libgcj, ie
'ser-dump' or something?
regards
[ bryce ]