Generally this question comes from Eclipse suggesting to add a serial version UID on an abstract class.
Since the class is abstract instances of this class will never exist thus they will never be serialized (only derived classes will be).
So my question is it safe to place a @SuppressWarnings("serial") on an abstract class who’s extenders will be serialized (and they will have serialVersionUIDs) ?
Also any other issues to be careful about when designing an abstract class who’s extenders will be serialized are welcome.
Thanks.
Every serialisable class needs a
serialVersionUID. If an object is of a runtime type that itself extends a serialisable class, then there are twoserialVersionUIDs involved. So, yes you need it, unless you decide not to support serialisation across versions (like Swing).