I have a sealed class (closed polymorphism) that i...
# serialization
r
I have a sealed class (closed polymorphism) that implements an interface (open). Is there a way to define the
SerializersModule
to define the subclasses for the open polymorphic interface via delegation to the sealed class, rather than listing all of the sealed classes subclasses explicitly (which the compiler will not check is exhaustive)? More in 🧵 .
I've tried:
Copy code
polymorphic(MyOpenInterface::class) {
  subclass(MySealed::class)
}
but that fails with:
Copy code
Serializer for MySealed can't be registered as a subclass for polymorphic serialization because its kind SEALED is not concrete. To work with multiple hierarchies, register it as a base class.
but I'm not sure how to do that.