Skip to content

Commit e898963

Browse files
committed
Reproduction of #474
1 parent b4191f5 commit e898963

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

release-notes/CREDITS-2.x

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Authors:
1313

1414
Contributors:
1515

16+
Marshall Pierce (marshallpierce@github)
17+
* #474: Reported disrespect for @JsonProperty on parent class
18+
1619
Christopher Mason (masoncj@github)
1720
* #194: Contributed test case for @JsonIdentityInfo usage
1821
(2.12.NEXT)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.fasterxml.jackson.module.kotlin.test.github
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty
4+
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
5+
import org.junit.Test
6+
import kotlin.test.assertEquals
7+
8+
class TestGithub474 {
9+
@Test
10+
fun jsonPropertyAnnotationRespectedOnParentClass() {
11+
open class Parent(@JsonProperty("parent-prop") val parent: String)
12+
class Child(@JsonProperty("child-prop") val child: String) : Parent(child)
13+
14+
assertEquals(
15+
"""{"child-prop":"foo","parent-prop":"foo"}""",
16+
jacksonObjectMapper().writeValueAsString(Child("foo"))
17+
)
18+
}
19+
}

0 commit comments

Comments
 (0)