File tree 2 files changed +22
-0
lines changed
main/kotlin/com/fasterxml/jackson/module/kotlin
test/kotlin/com/fasterxml/jackson/module/kotlin/test/github
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,8 @@ internal class KotlinValueInstantiator(
78
78
paramDef.isOptional -> return @forEachIndexed
79
79
// do not try to create any object if it is nullable and the value is missing
80
80
paramType.isMarkedNullable -> null
81
+ // Primitive types always try to get from a buffer, considering several settings
82
+ jsonProp.type.isPrimitive -> buffer.getParameter(jsonProp)
81
83
// to get suitable "missing" value provided by deserializer
82
84
else -> jsonProp.valueDeserializer?.getAbsentValue(ctxt)
83
85
}
Original file line number Diff line number Diff line change
1
+ package com.fasterxml.jackson.module.kotlin.test.github
2
+
3
+ import com.fasterxml.jackson.annotation.JsonSetter
4
+ import com.fasterxml.jackson.annotation.Nulls
5
+ import com.fasterxml.jackson.databind.exc.MismatchedInputException
6
+ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
7
+ import com.fasterxml.jackson.module.kotlin.readValue
8
+ import org.junit.Assert.assertThrows
9
+ import org.junit.Test
10
+
11
+ class Github738 {
12
+ data class D (@JsonSetter(nulls = Nulls .FAIL ) val v : Int )
13
+
14
+ @Test
15
+ fun test () {
16
+ val mapper = jacksonObjectMapper()
17
+ // nulls = FAIL is reflected if it is primitive and missing
18
+ assertThrows(MismatchedInputException ::class .java) { mapper.readValue<D >(" {}" ) }
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments