I came across a exception handler class that extends exception as follows:
public class AppFileReaderException extends Exception {
//Explicit serialization UID added
private static final long serialVersionUID = -2458461415998318236L;
public AppFileReaderException(String msg)
{
super(msg);
}
The author used an explicit serialization version UID and has ignored the same in other similar exception handler classes. Based on what I understood from another SO post, we can ignore the serialization UID if the application is not using any serialization and deserialization. Oddly, the author used a negative UID. I am curious to know if that is valid or recommended practice. Is there any other reason to use a negative serialVersionUID?