Question

In my Eclipse I was trying example on serialization and I came across following warning

enter image description here

I know what serialVersionUID is and what is it's significance in Serialization. I have following questions about this warning

  1. How does IDE assign default value. Is it hard coded in the IDE?
  2. When it says generate id what parameters are used to generate new id?
  3. Not sure what the 3rd option is. Says something about suppress annotation. Does that mean no id is assigned at all. In that case what is used in serialization?
Was it helpful?

Solution

How does IDE assign default value. Is it hard coded in the IDE?

yes default is hard coded value, which is 1L

When it says generate id what parameters are used to generate new id?

generally method fields and method signatures should used to determine it, since you are asking specifically about eclipse, not sure about it, there is a serialver utillity which simply gives you serialVersionUID for your class

$serialver A
serialver A:    static final long serialVersionUID = -609421954100196333L;

Not sure what the 3rd option is. Says something about suppress annotation. Does that mean no id is assigned at all. In that case what is used in serialization?

it says, instruct java compiler to not complain about this particular warning for this case by adding @SuppressWarning annotation


Also See

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top