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
msg ="Instantiation of $itemType$paramType failed for JSON property ${jsonProp.name} due to null value in a $paramType that does not allow null values"
56
+
).wrapWithPath(this.valueClass, jsonProp.name)
57
+
}
58
+
}
59
+
31
60
overridefuncreateFromObjectWith(
32
61
ctxt:DeserializationContext,
33
62
props:Array<outSettableBeanProperty>,
@@ -47,11 +76,9 @@ internal class KotlinValueInstantiator(
47
76
}
48
77
49
78
var paramVal =if (!isMissing || paramDef.isPrimitive || jsonProp.hasInjectableValueId()) {
50
-
val tempParamVal = buffer.getParameter(jsonProp)
51
-
if (nullIsSameAsDefault && tempParamVal ==null&& paramDef.isOptional) {
52
-
return@forEachIndexed
79
+
buffer.getParameter(jsonProp).apply {
80
+
if (nullIsSameAsDefault &&this==null&& paramDef.isOptional) return@forEachIndexed
53
81
}
54
-
tempParamVal
55
82
} else {
56
83
if (paramDef.isNullable) {
57
84
// do not try to create any object if it is nullable and the value is missing
@@ -62,37 +89,23 @@ internal class KotlinValueInstantiator(
val isMissingAndRequired = paramVal ==null&& isMissing && jsonProp.isRequired
70
-
if (isMissingAndRequired || (!paramDef.isGenericType && paramVal ==null&&!paramDef.isNullable)) {
71
-
throwMissingKotlinParameterException(
72
-
parameter = paramDef,
73
-
processor = ctxt.parser,
74
-
msg ="Instantiation of ${this.valueTypeDesc} value failed for JSON property ${jsonProp.name} due to missing (therefore NULL) value for creator parameter ${paramDef.name} which is a non-nullable type"
75
-
).wrapWithPath(this.valueClass, jsonProp.name)
76
-
}
77
-
78
-
if (strictNullChecks && paramVal !=null) {
79
-
// If an error occurs, Argument.name is always non-null
msg ="Instantiation of $itemType$paramType failed for JSON property ${jsonProp.name} due to null value in a $paramType that does not allow null values"
Copy file name to clipboardExpand all lines: src/test/kotlin/com/fasterxml/jackson/module/kotlin/_ported/test/PropertyRequirednessTests.kt
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,9 @@ class TestPropertyRequiredness {
85
85
valf:TestParamClass?,
86
86
valg:TestParamClass = TestParamClass(),
87
87
valh:TestParamClass? = TestParamClass(),
88
-
@JsonProperty("x", required =true) valx:Int?, // TODO: either error in test case with this not being on the property getter, or error in introspection not seeing this on the constructor parameter
88
+
// TODO: either error in test case with this not being on the property getter,
89
+
// or error in introspection not seeing this on the constructor parameter
0 commit comments