• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setting serialVersionUID

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On the warning about a serialiable class not having an id, Eclipse offers 3 quick fixes:

Add default serial version ID
Add generated serial version ID
Add @SuppressWarnings to class

Of the first 2, is one always better, if not when is one better?

About the last option, it seems wrong to me to ignore any warning. Ia this not the case?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
None of these three is "better" -- each has an appropriate use. The third one is perfectly appropriate if you choose not to worry about versioning for the class -- i.e., if the serialized data will never be stored in a file or shared with some other revision of this same program. Otherwise the first one is perfectly fine; I can't imagine any situation where the second one would be preferable, but it's also not worse in any way.
 
reply
    Bookmark Topic Watch Topic
  • New Topic