jackson-module-kogera icon indicating copy to clipboard operation
jackson-module-kogera copied to clipboard

When directly deserializing a `value class` that wraps a nullable, deserialization fails if the input is `null`.

Open k163377 opened this issue 1 year ago • 0 comments

The ValueClassDeserializer::getBoxedNullValue is called only from the KotlinValueInstantiator. This causes deserialization to fail as per the subject.

@JvmInline
value class NullableObject(val v: String?)

val result = mapper.readValue<NullableObject>("null")

This problem can be avoided by implementing getNullValue to the inherent ValueClassDeserializer. However, the general implementation of Kogera does not use getNullValue because of the problem in the more major cases. Also, the above problems make it difficult to solve this problem.

k163377 avatar Jan 14 '24 12:01 k163377