Skip to content

Commit

Permalink
Porting #817
Browse files Browse the repository at this point in the history
  • Loading branch information
k163377 committed Nov 10, 2024
1 parent 623edaa commit 7b6a371
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public inline fun <reified T> ObjectMapper.readValue(src: ByteArray): T = readVa

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

public inline fun <reified T> ObjectReader.readValueTyped(jp: JsonParser): T = readValue(jp, jacksonTypeRef<T>())
public inline fun <reified T> ObjectReader.readValuesTyped(jp: JsonParser): Iterator<T> =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package io.github.projectmapk.jackson.module.kogera.zPorted.test.github

import com.fasterxml.jackson.databind.json.JsonMapper
import io.github.projectmapk.jackson.module.kogera.KotlinFeature
import io.github.projectmapk.jackson.module.kogera.KotlinModule
import io.github.projectmapk.jackson.module.kogera.convertValue
import org.junit.jupiter.api.Assertions.assertNull
import org.junit.jupiter.api.Test

class GitHub757 {
@Test
fun test() {
val kotlinModule = KotlinModule.Builder()
.enable(KotlinFeature.StrictNullChecks)
.build()
val mapper = JsonMapper.builder()
.addModule(kotlinModule)
.build()
val convertValue = mapper.convertValue<String?>(null)
assertNull(convertValue)
}
}

0 comments on commit 7b6a371

Please sign in to comment.