Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » serialVersionUID for EventObject
serialVersionUID for EventObject [message #452506] Mon, 21 March 2005 19:25 Go to next message
Susan Foster is currently offline Susan FosterFriend
Messages: 26
Registered: July 2009
Junior Member
I recently updated to Eclipse 3.1.0M5 and started using JDK 1.5.

I have some classes that extend EventObject that now have warnings that
they lack a serialVersionUID.

Should I add a default serialVersionUID, generate a new one, or disregard
the warning?

Is there a link to a good explanation of what the serialVersionUID does
and why I want it for EventObjects? I am not worried about compatability
between versions of the JVM or Eclipse for my application.
Re: serialVersionUID for EventObject [message #452508 is a reply to message #452506] Mon, 21 March 2005 18:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Susan Foster wrote:
> I recently updated to Eclipse 3.1.0M5 and started using JDK 1.5.
> I have some classes that extend EventObject that now have warnings that
> they lack a serialVersionUID.
> Should I add a default serialVersionUID, generate a new one, or
> disregard the warning?
> Is there a link to a good explanation of what the serialVersionUID does
> and why I want it for EventObjects? I am not worried about
> compatability between versions of the JVM or Eclipse for my application.

if you are not persisting your event objects to the file system using
default serilization you should not add the serialVersionUID. If you
do, you will not be responsible for changing it when the class it is
part of changes in an appreciable way.

Just my opinion.


the UID is used to 'version' the class. So if 2 incompatible versions
are bing used, the serialization mechanism will complain. For instance,
if you are marshalling your objects across RMI, if both ends don't use
the same SUID, an exception will be thrown.


CL
Re: serialVersionUID for EventObject [message #452549 is a reply to message #452506] Tue, 22 March 2005 04:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: swsnider.gmail.com

Susan Foster wrote:
> I recently updated to Eclipse 3.1.0M5 and started using JDK 1.5.
> I have some classes that extend EventObject that now have warnings that
> they lack a serialVersionUID.
> Should I add a default serialVersionUID, generate a new one, or
> disregard the warning?
> Is there a link to a good explanation of what the serialVersionUID does
> and why I want it for EventObjects? I am not worried about
> compatability between versions of the JVM or Eclipse for my application.

serialVersionUID allows you to serialize objects without having to worry
about versioning problems. So, typically, you don't need to worry about
it, especially with an EventObject.

Sincerely,
Silas Snider
Re: serialVersionUID for EventObject [message #452550 is a reply to message #452506] Tue, 22 March 2005 04:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bob.objfac.com

serialVersionUID is supposed to reflect the "version" of a serialized
object. If the serialVersionUID changes, saved data may not be
recoverable. But it may be. IIRC, the deserializer makes a stab at it
anyway. I forget the rules, but anyway they are
implementation-dependent. What most people do is set serialVersionUID to
a constant (the generated one as a snapshot in time is as good as any
and better than e.g., 1L) and never change it unless they make changes
to the object such that deserializing no longer is able to instantiate
the object properly.

Someone should provide a link.

Bob

Susan Foster wrote:
> I recently updated to Eclipse 3.1.0M5 and started using JDK 1.5.
> I have some classes that extend EventObject that now have warnings that
> they lack a serialVersionUID.
> Should I add a default serialVersionUID, generate a new one, or
> disregard the warning?
> Is there a link to a good explanation of what the serialVersionUID does
> and why I want it for EventObjects? I am not worried about
> compatability between versions of the JVM or Eclipse for my application.
Re: serialVersionUID for EventObject [message #452565 is a reply to message #452549] Tue, 22 March 2005 13:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Silas Snider wrote:
> Susan Foster wrote:
>
>> I recently updated to Eclipse 3.1.0M5 and started using JDK 1.5. I
>> have some classes that extend EventObject that now have warnings that
>> they lack a serialVersionUID. Should I add a default serialVersionUID,
>> generate a new one, or disregard the warning? Is there a link to a
>> good explanation of what the serialVersionUID does and why I want it
>> for EventObjects? I am not worried about compatability between
>> versions of the JVM or Eclipse for my application.
>
>
> serialVersionUID allows you to serialize objects without having to worry
> about versioning problems. So, typically, you don't need to worry about
> it, especially with an EventObject.
>
> Sincerely,
> Silas Snider

SUID does not alievate your concern over versions. It masks potential
mistakes, which are usually not mistakes, but not always.

CL
Re: serialVersionUID for EventObject [message #452574 is a reply to message #452506] Tue, 22 March 2005 18:58 Go to previous message
Eclipse UserFriend
Originally posted by: Ken.Rojas.ars.usda.gov

There's a good discussion on serialization from sun:

http://java.sun.com/developer/technicalArticles/Programming/ serialization/

Ken Rojas
USDA-NRCS-ITC
2150 Centre Avenue, Building D, Suite 200; Ft. Collins, CO 80526 (970)492-7326 krojas@itc.nrcs.usda.gov

>>> Susan Foster<susan.b.foster@intel.com> 3/21/2005 12:25:30 PM >>>
I recently updated to Eclipse 3.1.0M5 and started using JDK 1.5.

I have some classes that extend EventObject that now have warnings that
they lack a serialVersionUID.

Should I add a default serialVersionUID, generate a new one, or disregard
the warning?

Is there a link to a good explanation of what the serialVersionUID does
and why I want it for EventObjects? I am not worried about compatability
between versions of the JVM or Eclipse for my application.
Previous Topic:IME Input Mode
Next Topic:Table Resize when parent resize
Goto Forum:
  


Current Time: Fri Apr 19 04:53:44 GMT 2024

Powered by FUDForum. Page generated in 0.01823 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top