File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github Expand file tree Collapse file tree 1 file changed +30
-0
lines changed 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.core.JsonGenerator
4
+ import com.fasterxml.jackson.databind.SerializerProvider
5
+ import com.fasterxml.jackson.databind.annotation.JsonSerialize
6
+ import com.fasterxml.jackson.databind.ser.std.StdSerializer
7
+ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
8
+ import org.junit.Test
9
+ import kotlin.test.assertEquals
10
+
11
+ class GitHub618 {
12
+ @JsonSerialize(using = V .Serializer ::class )
13
+ @JvmInline
14
+ value class V (val value : String ) {
15
+ class Serializer : StdSerializer <V >(V : :class.java) {
16
+ override fun serialize (p0 : V , p1 : JsonGenerator , p2 : SerializerProvider ) {
17
+ p1.writeString(p0.toString())
18
+ }
19
+ }
20
+ }
21
+
22
+ data class D (val v : V ? )
23
+
24
+ @Test
25
+ fun test () {
26
+ val mapper = jacksonObjectMapper()
27
+ // expected: {"v":null}, but NullPointerException thrown
28
+ assertEquals(""" {"v":null}""" , mapper.writeValueAsString(D (null )))
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments