It depends on what method is used to serialize the class.
If the default method is used, you need to declare transient everything
that is not part of the documented serialized form.
If you write your own writeObject method, declaring things transient
is not needed since you'll have to do everything explicitly anyway,
and you can include the thing that must be serialized and omit the things you 
consider "transient".

In any event, I'd recommend declaring variables you don't serialize
to be transient since even if you do have your own writeObject method,
it will add some element of clarity to it.

        - Godmar


> 
> A question about serialization.  Do we have to make any instance variables
> that aren't supposed to be serialized in the spec as transiet or something? 
> If we don't have to do that, we need to document which variables are
> serialized in our code.  This keeps people from changing their names or
> eliminating them during optimization or something.  I was thinking we could
> use a Javadoc like "@serialized" tag to indicate these.  That would also
> facilitate extracting the comments for them out and creating our own
> "Serialized Form" document.  If we do have to make everything not serialized
> as transient, then we don't need to do any of that.
> 
> Comments?
> 
> -- 
> Aaron M. Renn ([EMAIL PROTECTED]) http://www.urbanophile.com/arenn/
> 

Reply via email to