Managing "Serialization" Warnings in Eclipse

Eclipse sometimes (such as when you are creating your own Exception classes) generates warning messages something like:

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

It is not necessary that you know about serializability for this course. In case you are interested, serializability is used to store the status of a program in an external file, or to support distributed (i.e., parallel) processing. In any event, we'd rather just get rid of the blasted warning.

The simplest solution is to tell Eclipse not to bother with such warnings. To do that, use the Preferences | Java | Compiler | Errors/Warnings menu. You'll see the entry "Potential programming problems" Under that you'll see "Serializable class without sersialVersionUID:". Go ahead and change that to "Ignore" and the warnings will go away. Below is an image of the dialog box that you'll be working with.

Preferences Setting in Eclipse

An alternative approach is to let Eclipse generate the necessary "serializabilization" method for you. You can do that by clicking on the little light bulb icon to the left of the offending line, and selecting the "Add generated serial version ID" option, as indicated below.

Eclipse suggests a repair