-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #710 from k163377/fix/default-prop
Fixed KotlinPropertyNameAsImplicitName not working in edge case
- Loading branch information
Showing
4 changed files
with
30 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/Github710.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.fasterxml.jackson.module.kotlin.test.github | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.module.kotlin.KotlinFeature | ||
import com.fasterxml.jackson.module.kotlin.KotlinModule | ||
import org.junit.Test | ||
import kotlin.test.assertEquals | ||
|
||
class Github710 { | ||
interface I<T> { | ||
val foo: T | ||
val bAr: T get() = foo | ||
} | ||
|
||
class C(override val foo: Int) : I<Int> | ||
|
||
@Test | ||
fun test() { | ||
val mapper = KotlinModule.Builder().enable(KotlinFeature.KotlinPropertyNameAsImplicitName) | ||
.let { ObjectMapper().registerModule(it.build()) } | ||
val result = mapper.writeValueAsString(C(1)) | ||
|
||
assertEquals("""{"foo":1,"bAr":1}""", result) | ||
} | ||
} |