I have a class A that extends another class B that implements Serializable interface.
I want to automatically generate the serialVersionUID for class A using the Eclipse.
If class A was the class that implements Serializable Eclipse will have a error compilation. Please help me generate it automatically.
class A
public class QueryOptionModel extends BaseModelData {
}
public class BaseModelData implements ModelData, Serializable
-
Please provide some further details - which error do you receive?home– home2012年02月26日 14:40:54 +00:00Commented Feb 26, 2012 at 14:40
-
i don't receive that's the probAdi Mor– Adi Mor2012年02月26日 14:42:07 +00:00Commented Feb 26, 2012 at 14:42
-
When your class's parent class extends a serializable class, |Eclipse asks you (warning) to provide a serialVersionUID. I don't get your problemtartak– tartak2012年02月26日 14:53:07 +00:00Commented Feb 26, 2012 at 14:53
-
the problem is that eclipse didn't ask me to provide a serialVersionUIDAdi Mor– Adi Mor2012年02月26日 15:22:34 +00:00Commented Feb 26, 2012 at 15:22
1 Answer 1
If you have a class which implements Serializable interface but doesn't specify a serialVersionUID, you'll get a warning. You can automatically ask Eclipse to fix that warning by clicking on the balloon which pops up on that line. Make sure you don't generate a random but a logical serialVersionUID i.e. 0 or 1 if this is the first draft of your serilizable class.