classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Serialver [was Re: [PATCH]]


From: Bryce McKinlay
Subject: Re: Serialver [was Re: [PATCH]]
Date: Tue, 20 Nov 2001 14:32:59 +1300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.5) Gecko/20011012

Eric Blake wrote:

Therefore, the safest course of action is to explicitly have a
serialVersionUID for all Serializeable classes, rather than relying on
the implicit UID generated by the undocumented hash behavior.

After reading your explanation, I agree.

Note that the serialVersionUID field should be a private variable (Sun's 
serialver
neglects this fact, making it seem like package-private is acceptable),
so that it is not inherited by other subclasses in the same package.


Actually this shouldn't matter, since the serialization code looks up serialVersionUID using getDeclaredField(), which will not return fields declared in superclasses.

regards

Bryce.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]