3

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 {
}

class b - gxt api

public class BaseModelData implements ModelData, Serializable
asked Feb 26, 2012 at 14:36
4
  • Please provide some further details - which error do you receive? Commented Feb 26, 2012 at 14:40
  • i don't receive that's the prob Commented 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 problem Commented Feb 26, 2012 at 14:53
  • the problem is that eclipse didn't ask me to provide a serialVersionUID Commented Feb 26, 2012 at 15:22

1 Answer 1

4

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.

answered Feb 26, 2012 at 14:41
Sign up to request clarification or add additional context in comments.

3 Comments

but my class extent a class that implement a the Serializable, and don't show the warning
I think you should post the code you are using. I do get a warning on my stock Eclipse installation.
Probably your compiler settings ignore this. You can change this in Eclipse: Open the properties of your project, select Java Compiler => Errors/Warnings and set the item Serializable class without serialVersionUID to Warning or Error.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.