@@ -22,16 +22,13 @@ internal class KotlinValueInstantiator(
22
22
private val cache : ReflectionCache ,
23
23
private val nullToEmptyCollection : Boolean ,
24
24
private val nullToEmptyMap : Boolean ,
25
- private val nullIsSameAsDefault : Boolean ,
26
- private val strictNullChecks : Boolean
25
+ private val nullIsSameAsDefault : Boolean
27
26
) : StdValueInstantiator(src) {
28
27
private fun JavaType.requireEmptyValue () =
29
28
(nullToEmptyCollection && this .isCollectionLikeType) || (nullToEmptyMap && this .isMapLikeType)
30
29
31
30
private fun KType.isGenericTypeVar () = javaType is TypeVariable <* >
32
31
33
- private fun List<KTypeProjection>.markedNonNullAt (index : Int ) = getOrNull(index)?.type?.isMarkedNullable == false
34
-
35
32
// If the argument is a value class that wraps nullable and non-null,
36
33
// and the input is explicit null, the value class is instantiated with null as input.
37
34
private fun requireValueClassSpecialNullValue (
@@ -104,35 +101,6 @@ internal class KotlinValueInstantiator(
104
101
).wrapWithPath(this .valueClass, pname)
105
102
}
106
103
}
107
- } else if (strictNullChecks) {
108
- val arguments = paramType.arguments
109
-
110
- // To make the behavior the same as deserialization of each element using NullsFailProvider,
111
- // first wrapWithPath with paramVal and key.
112
- val ex = when {
113
- propType.isCollectionLikeType && arguments.markedNonNullAt(0 ) -> {
114
- (paramVal as Collection <* >).indexOf(null ).takeIf { it >= 0 }?.let {
115
- InvalidNullException .from(ctxt, jsonProp.fullName, jsonProp.type)
116
- .wrapWithPath(paramVal, it)
117
- }
118
- }
119
- propType.isMapLikeType && arguments.markedNonNullAt(1 ) -> {
120
- (paramVal as Map <* , * >).entries.find { (_, v) -> v == null }?.let { (k, _) ->
121
- InvalidNullException .from(ctxt, jsonProp.fullName, jsonProp.type)
122
- .wrapWithPath(paramVal, k.toString())
123
- }
124
- }
125
- propType.isArrayType && arguments.markedNonNullAt(0 ) -> {
126
- (paramVal as Array <* >).indexOf(null ).takeIf { it >= 0 }?.let {
127
- InvalidNullException .from(ctxt, jsonProp.fullName, jsonProp.type)
128
- .wrapWithPath(paramVal, it)
129
- }
130
- }
131
- else -> null
132
- }
133
-
134
- // Then, wrapWithPath with this property.
135
- ex?.let { throw it.wrapWithPath(this .valueClass, jsonProp.name) }
136
104
}
137
105
138
106
bucket[paramDef] = paramVal
@@ -151,7 +119,6 @@ internal class KotlinInstantiators(
151
119
private val nullToEmptyCollection : Boolean ,
152
120
private val nullToEmptyMap : Boolean ,
153
121
private val nullIsSameAsDefault : Boolean ,
154
- private val strictNullChecks : Boolean
155
122
) : ValueInstantiators {
156
123
override fun findValueInstantiator (
157
124
deserConfig : DeserializationConfig ,
@@ -165,8 +132,7 @@ internal class KotlinInstantiators(
165
132
cache,
166
133
nullToEmptyCollection,
167
134
nullToEmptyMap,
168
- nullIsSameAsDefault,
169
- strictNullChecks
135
+ nullIsSameAsDefault
170
136
)
171
137
} else {
172
138
// TODO: return defaultInstantiator and let default method parameters and nullability go unused? or die with exception:
0 commit comments