Skip to content

Consider unifying serial names of SealedClassSerializer and PolymorphicClassSerializer #3104

@sandwwraith

Description

@sandwwraith

Currently they have different formats:

interface X

@Serializable
sealed interface Y

@Test
fun names() {
    println(serializer<X>().descriptor.serialName) // kotlinx.serialization.Polymorphic<X>
    println(serializer<Y>().descriptor.serialName) // kotlinx.serialization.features.DefaultPolymorphicSerializerTest.Y
}

Moreover, X's name is not affected by @SerialName (

override val serialName = "${original.serialName}<${kClass.simpleName}>"
).

Changing it would bring uniformity in exception messages, but it is a potential breaking change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions