Skip to content

MissingKotlinParameterException contains non-serializable KParameterImpl, breaking Throwable contract #572

@ghost

Description

Describe the bug

This bug is an offspring of spring-projects/spring-kafka#2306

As described there spring-kafka tries to serialize exceptions, which fails with

java.lang.RuntimeException: Could not deserialize type java.io.NotSerializableException with message kotlin.reflect.jvm.internal.KParameterImpl failure: kotlin.reflect.jvm.internal.KParameterImpl

To Reproduce

  • Create an instance of com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException
  • Create an ObjectOutputStream and try to write the exception object into the stream

Expected behavior

As MissingKotlinParameterException implements Serializable it should be serializable without any execptions.

Three options:
a) make KParameter property transient
b) implement special handling of non-serializable properties by implemeting writeObject/readObject
c) Request the kotlin people to implement KParameter classes as serializable

Versions
Kotlin: 1.7.0
Jackson-module-kotlin: 2.13.3
Jackson-databind: 2.13.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.16For issues planned for 2.16bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions