Saturday 6 April 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...