File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ Authors:
1616Contributors :
1717
1818# 2 .18.0 (not yet released)
19+
20+ WrongWrong (@k163377 )
21+ * #817 : Fixed nullability of convertValue function argument
1922* #782 : Organize deprecated contents
2023* #542 : Remove meaningless checks and properties in KNAI
2124
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ Co-maintainers:
1818
19192.18 .0 (not yet released )
2020
21+ #817 : The convertValue extension function now accepts null
2122#803 : Kotlin has been upgraded to 1.8 .10 .
2223 The reason 1.8 .22 is not used is to avoid KT - 65156.
2324#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
6161inline fun <reified T > ObjectMapper.readValue (src : ByteArray ): T = readValue(src, jacksonTypeRef<T >())
6262
6363inline 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 >())
6565
6666inline fun <reified T > ObjectReader.readValueTyped (jp : JsonParser ): T = readValue(jp, jacksonTypeRef<T >())
6767inline 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