File tree 4 files changed +27
-1
lines changed
main/kotlin/com/fasterxml/jackson/module/kotlin
test/kotlin/com/fasterxml/jackson/module/kotlin/test/github
4 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ Authors:
16
16
Contributors :
17
17
18
18
# 2 .18.0 (not yet released)
19
+
20
+ WrongWrong (@k163377 )
21
+ * #817 : Fixed nullability of convertValue function argument
19
22
* #782 : Organize deprecated contents
20
23
* #542 : Remove meaningless checks and properties in KNAI
21
24
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ Co-maintainers:
18
18
19
19
2.18 .0 (not yet released )
20
20
21
+ #817 : The convertValue extension function now accepts null
21
22
#803 : Kotlin has been upgraded to 1.8 .10 .
22
23
The reason 1.8 .22 is not used is to avoid KT - 65156.
23
24
#782 : Content marked as deprecated has been reorganized.
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ inline fun <reified T> ObjectMapper.readValue(src: InputStream): T = readValue(s
61
61
inline fun <reified T > ObjectMapper.readValue (src : ByteArray ): T = readValue(src, jacksonTypeRef<T >())
62
62
63
63
inline fun <reified T > ObjectMapper.treeToValue (n : TreeNode ): T = readValue(this .treeAsTokens(n), jacksonTypeRef<T >())
64
- inline fun <reified T > ObjectMapper.convertValue (from : Any ): T = convertValue(from, jacksonTypeRef<T >())
64
+ inline fun <reified T > ObjectMapper.convertValue (from : Any? ): T = convertValue(from, jacksonTypeRef<T >())
65
65
66
66
inline fun <reified T > ObjectReader.readValueTyped (jp : JsonParser ): T = readValue(jp, jacksonTypeRef<T >())
67
67
inline fun <reified T > ObjectReader.readValuesTyped (jp : JsonParser ): Iterator <T > = readValues(jp, jacksonTypeRef<T >())
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.databind.json.JsonMapper
4
+ import com.fasterxml.jackson.module.kotlin.KotlinFeature
5
+ import com.fasterxml.jackson.module.kotlin.KotlinModule
6
+ import com.fasterxml.jackson.module.kotlin.convertValue
7
+ import kotlin.test.Test
8
+ import kotlin.test.assertNull
9
+
10
+ class GitHub757 {
11
+ @Test
12
+ fun test () {
13
+ val kotlinModule = KotlinModule .Builder ()
14
+ .enable(KotlinFeature .StrictNullChecks )
15
+ .build()
16
+ val mapper = JsonMapper .builder()
17
+ .addModule(kotlinModule)
18
+ .build()
19
+ val convertValue = mapper.convertValue<String ?>(null )
20
+ assertNull(convertValue)
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments