File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
main/kotlin/com/fasterxml/jackson/module/kotlin
test/kotlin/com/fasterxml/jackson/module/kotlin/test/github Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -102,11 +102,11 @@ internal class KotlinValueInstantiator(
102
102
tempParamVal
103
103
} else {
104
104
if (paramDef.type.isMarkedNullable) {
105
- // do not try to create any object if it is nullable
105
+ // do not try to create any object if it is nullable and the value is missing
106
106
null
107
107
} else {
108
- // trying to get suitable "missing" value provided by deserializer
109
- jsonProp.valueDeserializer?.getNullValue (ctxt)
108
+ // to get suitable "missing" value provided by deserializer
109
+ jsonProp.valueDeserializer?.getAbsentValue (ctxt)
110
110
}
111
111
}
112
112
Original file line number Diff line number Diff line change 1
1
package com.fasterxml.jackson.module.kotlin.test.github
2
2
3
3
import com.fasterxml.jackson.databind.JsonNode
4
+ import com.fasterxml.jackson.databind.node.NullNode
4
5
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
5
6
import com.fasterxml.jackson.module.kotlin.readValue
6
7
import org.hamcrest.CoreMatchers
@@ -45,9 +46,9 @@ class TestGithub490 {
45
46
@Test
46
47
fun testKotlinDeserialization_jsonNodeValueProvidedNull () {
47
48
assertThat(
48
- " Nullable JsonNode value provided as null should be deserialized as null and not as NullNode" ,
49
+ " Nullable JsonNode value provided as null should be deserialized as NullNode" ,
49
50
value.jsonNodeValueProvidedNull,
50
- CoreMatchers .nullValue( )
51
+ CoreMatchers .equalTo( NullNode .instance )
51
52
)
52
53
}
53
54
@@ -63,9 +64,9 @@ class TestGithub490 {
63
64
@Test
64
65
fun testKotlinDeserialization_jsonNodeValueWithNullAsDefaultProvidedNull () {
65
66
assertThat(
66
- " Nullable by default JsonNode with provided null value in payload should be deserialized as null and not as NullNode" ,
67
+ " Nullable by default JsonNode with provided null value in payload should be deserialized as NullNode" ,
67
68
value.jsonNodeValueWithNullAsDefaultProvidedNull,
68
- CoreMatchers .nullValue( )
69
+ CoreMatchers .equalTo( NullNode .instance )
69
70
)
70
71
}
71
72
}
You can’t perform that action at this time.
0 commit comments