To make a class serializable we do the following:
class A implements Serializable {
transient Object a;
}
And not this:
So you're asking why you can't mark a class as not serializable (like a transient member)? Why wouldn't you just not mark class members of the not-to-serialize type as transient? Or use a serialization delegate for that class type when you do the serialization? It seems a little weird that you would want to tell Java to not do something at this level instead of telling it to do something.