You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched in the issues and found nothing similar.
I have confirmed that the same problem is not reproduced if I exclude the KotlinModule.
I searched in the issues of databind and other modules used and found nothing similar.
I have confirmed that the problem does not reproduce in Java and only occurs when using Kotlin and KotlinModule.
Describe the bug
Error occurs during deserialization of my generic class:
com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException: Instantiation of [simple type, class SerializationTest$test_deserialization$Example<java.lang.String>] value failed for JSON property data due to missing (therefore NULL) value for creator parameter data which is a non-nullable type
at [Source: (StringReader); line: 3, column: 1] (through reference chain: SerializationTest$test_deserialization$Example["data"])
at com.fasterxml.jackson.module.kotlin.KotlinValueInstantiator.createFromObjectWith(KotlinValueInstantiator.kt:97)
at com.fasterxml.jackson.databind.deser.impl.PropertyBasedCreator.build(PropertyBasedCreator.java:214)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:541)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1497)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:348)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:185)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:342)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4917)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3860)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3843)
at SerializationTest.test_deserialization(SerializationTest.kt:36)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Janik7777
changed the title
Deserialization fo generic class with nullable values failes
Deserialization of generic class with nullable values failes
Feb 14, 2025
Search before asking
Describe the bug
Error occurs during deserialization of my generic class:
This is my data class
I want use it for non null and nullable data types for T. One example usage would be:
We want our YAML file only to include non-null fields, so we use the option
setSerializationInclusion(JsonInclude.Include.NON_NULL)
for the mapper.But now the deserialization fails.
To Reproduce
Expected behavior
deserializedValue == Example<String?>(null, 10)
Versions
Kotlin:
Jackson-module-kotlin: 2.18.2
Jackson-databind: 2.18.2
Additional context
No response
The text was updated successfully, but these errors were encountered: