@@ -11,7 +11,6 @@ import com.fasterxml.jackson.databind.deser.ValueInstantiators
11
11
import com.fasterxml.jackson.databind.deser.impl.NullsAsEmptyProvider
12
12
import com.fasterxml.jackson.databind.deser.impl.PropertyValueBuffer
13
13
import com.fasterxml.jackson.databind.deser.std.StdValueInstantiator
14
- import com.fasterxml.jackson.databind.exc.MismatchedInputException
15
14
import java.lang.reflect.TypeVariable
16
15
import kotlin.reflect.KParameter
17
16
import kotlin.reflect.KType
@@ -67,24 +66,20 @@ internal class KotlinValueInstantiator(
67
66
val jsonProp = props[idx]
68
67
val isMissing = ! buffer.hasParameter(jsonProp)
69
68
70
- if (isMissing && paramDef.isOptional) {
71
- return @forEachIndexed
72
- }
73
-
74
69
val paramType = paramDef.type
75
- var paramVal = if (! isMissing || paramDef.isPrimitive() || jsonProp.hasInjectableValueId()) {
70
+ var paramVal = if (! isMissing || jsonProp.hasInjectableValueId()) {
76
71
val tempParamVal = buffer.getParameter(jsonProp)
77
72
if (tempParamVal == null && jsonProp.skipNulls() && paramDef.isOptional) {
78
73
return @forEachIndexed
79
74
}
80
75
tempParamVal
81
76
} else {
82
- if (paramType.isMarkedNullable) {
77
+ when {
78
+ paramDef.isOptional -> return @forEachIndexed
83
79
// do not try to create any object if it is nullable and the value is missing
84
- null
85
- } else {
80
+ paramType.isMarkedNullable -> null
86
81
// to get suitable "missing" value provided by deserializer
87
- jsonProp.valueDeserializer?.getAbsentValue(ctxt)
82
+ else -> jsonProp.valueDeserializer?.getAbsentValue(ctxt)
88
83
}
89
84
}
90
85
@@ -157,13 +152,6 @@ internal class KotlinValueInstantiator(
157
152
158
153
}
159
154
160
- private fun KParameter.isPrimitive (): Boolean {
161
- return when (val javaType = type.javaType) {
162
- is Class <* > -> javaType.isPrimitive
163
- else -> false
164
- }
165
- }
166
-
167
155
private fun SettableBeanProperty.hasInjectableValueId (): Boolean = injectableValueId != null
168
156
}
169
157
0 commit comments