• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SerialsUID

 
mark I thomas
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I write a class that implements Serializable. The compiler gave me warning that I did not create a static
serial UID for it. Usign IDE's quick fix, I saw two options -- One is to create a default UID and the other is to create a generated UID.

I chose to create a generated UID and it added a long int to the class. I also tried using a default UID then it added a "1L" to the class.

My question is --- What's the difference between them and is it fine that I chose to use a generated ? Secondly, the default looks so common (1L), wouldn't it be used by other classes as well ? Why does it creates such a common UID (1L) ?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because it's the default ("version one"), and serial version IDs are unique across a single class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic