Saturday, April 6, 2019

java - how to remove the warning The serializable class ClASSNAME does not declare a static final serialVersionUID field of type long





I create a class which extends Exception class, I got this warning on Eclipse




The serializable class PhoneAlreadyExists does not declare a static
final serialVersionUID field of type long




how to remove it please ?



public class PhoneAlreadyExists extends Exception {

public PhoneAlreadyExists() {
// TODO Auto-generated constructor stub
super();
}

PhoneAlreadyExists(String message) {
super(message);
}

}


Answer



Add an annotation @SuppressWarnings("serial") on your class, to ignore that warning


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...