Skip to content

Commit 7b6a371

Browse files
committed
1 parent 623edaa commit 7b6a371

File tree

2 files changed

+23
-1
lines changed
  • src
    • main/kotlin/io/github/projectmapk/jackson/module/kogera
    • test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github

2 files changed

+23
-1
lines changed

src/main/kotlin/io/github/projectmapk/jackson/module/kogera/Extensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public inline fun <reified T> ObjectMapper.readValue(src: ByteArray): T = readVa
6262

6363
public inline fun <reified T> ObjectMapper.treeToValue(n: TreeNode): T =
6464
readValue(this.treeAsTokens(n), jacksonTypeRef<T>())
65-
public inline fun <reified T> ObjectMapper.convertValue(from: Any): T = convertValue(from, jacksonTypeRef<T>())
65+
public inline fun <reified T> ObjectMapper.convertValue(from: Any?): T = convertValue(from, jacksonTypeRef<T>())
6666

6767
public inline fun <reified T> ObjectReader.readValueTyped(jp: JsonParser): T = readValue(jp, jacksonTypeRef<T>())
6868
public inline fun <reified T> ObjectReader.readValuesTyped(jp: JsonParser): Iterator<T> =
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package io.github.projectmapk.jackson.module.kogera.zPorted.test.github
2+
3+
import com.fasterxml.jackson.databind.json.JsonMapper
4+
import io.github.projectmapk.jackson.module.kogera.KotlinFeature
5+
import io.github.projectmapk.jackson.module.kogera.KotlinModule
6+
import io.github.projectmapk.jackson.module.kogera.convertValue
7+
import org.junit.jupiter.api.Assertions.assertNull
8+
import org.junit.jupiter.api.Test
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+
}

0 commit comments

Comments
 (0)