Emil Kantis

    Emil Kantis

    1 year ago
    Are there any plans on supporting polymorphic serialization of sealed interfaces?
    Dominaezzz

    Dominaezzz

    1 year ago
    It's supported, unless you mean automatically.
    Emil Kantis

    Emil Kantis

    1 year ago
    I mean automatically.. e.g. I would like to be able to have this:
    @Serializable
    sealed interface Animal { val name: String }
    
    @Serializable
    class Cat(override val name: String): Animal
    
    @Serializable
    class Dog(override val name: String): Animal
    Currently it works great if you use
    sealed class
    , but an interface feels cleaner when we only have abstract properties
    c

    CLOVIS

    1 year ago
    Also, with an interface it is possible to reuse classes in multiple hierarchies.