Although I'm not currently planning to serialize anything, I give all serializable outer classes, as well as static nested classes a SerialVersionUID
, because that is the proper way to do it.
However, I've read here that
Serialization of inner classes (i.e., nested classes that are not static member classes), including local and anonymous classes, is strongly discouraged for several reasons. ...
So my question is:
Should I give inner and anonymous classes a SerialVersionUID
each, or should I add a @SuppressWarnings("serial")
to those?
Is one way more proper than the other?
I will in any case make references to such classes transient, because I don't want them to be serialized.