Join Slack
Powered by
Does polymorphic deserialisation work with sealed ...
# serialization
a
aidanvii
10/13/2021, 7:43 AM
Does polymorphic deserialisation work with sealed interfaces? Just wondering as it’s ever so slightly less verbose than sealed classes.
s
sindrenm
10/13/2021, 7:55 AM
Nope. I believe it's because you need
@Serializable
on the sealed type, which can't be applied to an interface, but there could be other reasons, too.
a
aidanvii
10/13/2021, 9:31 AM
I found an open issue for it
https://github.com/Kotlin/kotlinx.serialization/issues/1417
🎉 1
p
pdvrieze
10/18/2021, 9:59 AM
Making serializable interfaces could be supported if all children are either sealed interfaces or class/object types. As such there is a little more complexity than obvious, but it is something that will likely be supported in the future.
3
Views
Open in Slack
Previous
Next