Hello everyone! I’m writing a library that depends...
# serialization
r
Hello everyone! I’m writing a library that depends on the serialization runtime. During this process, I need to determine that a serializer for a sealed class subtype belongs to a particular index concerning the rest of the cases. I found
kotlinx.serialization.SealedClassSerializer
, which has a
subclassSerializers: Array<KSerializer<out T>>
constructor parameter but it’s not exposed. Otherwise, I could obtain the index based on that property. Is there any other way to obtain a stable index of a sealed subclass serializer or its descriptor with any other APIs? If the `SealedClassSerializer is the only way to go, would the Jetbrains compiler team be open to a PR to that class to expose
fun indexOf(subClassSerializer: ...): Int
or make
subclassSerializers
a
public val
?. Any help is appreciated, thanks! 🙏