Serializable
classes whose closest non-serializable ancestor doesn't have
a no-argument constructor. Such classes cannot be deserialized and will fail with an InvalidClassException
.
Example:
class Ancestor {
private String name;
Ancestor(String name) {
this.name = name;
}
}
// warning on this class because the superclass is not
// serializable, and its constructor takes arguments
class Descendant extends Ancestor implements Serializable {
Descendant() {
super("Bob");
}
}