so what exactly is polymorphic serialization? I'm ...
# serialization
k
so what exactly is polymorphic serialization? I'm having trouble even understanding what the issue is 🙂
a
Okay, here we go Polymorphic serialization is done when you are trying to serializes classes with polymorphism. Why it mostly works out of the box. If you are using sealed classes, polymorphic serialization is handled out of the box by the serialization compiler plugin If you try to serialize non sealed classes that extends other classes without registering them as polymorphic modules, you'll get the error above
k
that helps a bit! I'm (de)serializing classes in two hierarchies - and both of them are sealed
maybe because one of the classes has a generic parameter
but still, I get the error after adding a new derivec class to an already pretty bit class hierarchy...
a
exactly. Also I don't think if generics play well if they are not registered for serialization
s
Maybe this can help you: https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/polymorphism.md#complex-hierarchies-with-several-base-classes Is your unregistered class is an inheritor of a sealed class? Then it should indeed work automatically. If it does not, you can try to get a minimal reproducer and file it to github issues