Without a @SerSubclasses
a variable can be any subtype, (it will just get deserialized to the subclass unless we implement #14) but once the annotation is added, equality checks are done on the field.getClass()
meaning subclasses will fail to get serialized properly.
This could be solved by using instanceof
checks instead (or even use the java 17 preview feature to pattern match, if available).
However this means we do need to sort the the classes (*) so that super classes are always checked before sub classes.
(*) This could however form a problem with #14 and #15, but even with custom serializers registered for interfaces, one could provide two interfaces as possible subclasses, and an object might implement both interfaces, which would complicate the sorting process.
🟩 priority: low 💻 aspect: code ✨ goal: improvement 🚧 status: blocked 💬 talk: discussion