Skip to content

serializer(KType) doesn't find types with custom serializers #3120

@CLOVIS-AI

Description

@CLOVIS-AI

Describe the bug

serializer(KType) and serializerOrNull(KType) find types annotated with @Serializable but not types annotated with @Serializable(with = …)

To Reproduce
Playground link: https://pl.kotl.in/GPVEn019Z

Expected behavior

The behavior of serializer(KType) should be identical for any class annotated with @Serializable, whether or not it uses with =.

Environment

  • Kotlin version: 2.2.21
  • Library version: 1.9.0
  • Kotlin platforms:
    • All non-JVM platforms
    • In my own project, this bug doesn't display itself on the JVM. However, the minimal reproducer I linked above on the Kotlin Playground does exhibit the bug, so I'm not sure what's going on.
  • Gradle version: 9.2, but I don't think it matters

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