[prev in list] [next in list] [prev in thread] [next in thread]
List: struts-user
Subject: Re: Serializable
From: Tamas Szabo <szabtam () gmail ! com>
Date: 2005-09-30 14:14:26
Message-ID: 5b224dc90509300714k596005b7n2aa07f3c96ef5d9b () mail ! gmail ! com
[Download RAW message or body]
On 9/30/05, Frank W. Zammetti <fzlists@omnytex.com> wrote:
>
> I'm not sure it is a stupid question... I guess this enters the realm of
> generic Java question, but I can't say I've ever thought about this
> before... what happens if you have a class that implements serializable,
> and you then extend that class and add a member that is NOT serializable?
> Does that get flagged at compile-time?
No. It is an error but it will be detected only at runtime.
A NotSerializableException will be thrown when an instance of the subclass
is serialized.
If you extend a class that is flagged to be Serializable, you must assure
that all the members are Serializable.
Adding a non Serializable member to a subclass of a Serializable class is
the same thing
as adding a non Serializable member to the Serializable class. And that's a=
n
error which will
be detected at runtime.
Tamas
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic