Skip to content

Commit

Permalink
Merge branch '2.18'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 31, 2024
2 parents 15be2b3 + 73f4ebf commit 81fdeb0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,4 @@ class TestGithub145 {
val person6Json = objectMapper.readValue<Person6>("""{"preName":"TestPreName","lastName":"TestLastname"}""")
}

// Cannot have companion object in class declared within function
class Person7 constructor(val preName: String, val lastName: String) {
private constructor(preNameAndLastName: String) : this(
preNameAndLastName.substringBefore(","),
preNameAndLastName.substringAfter(",")
)

companion object {
@JsonCreator
@JvmStatic
fun createFromJson(preNameAndLastName: String): Person7 {
return Person7(preNameAndLastName)
}
}
}

@Test
fun testPerson7() {
val person7String = objectMapper.readValue<Person7>(""""TestPreName,TestLastname"""")
val person7Json = objectMapper.readValue<Person7>("""{"preName":"TestPreName","lastName":"TestLastname"}""")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package tools.jackson.module.kotlin.test.github.failing

import org.junit.Test

import com.fasterxml.jackson.annotation.JsonCreator

import tools.jackson.module.kotlin.jacksonObjectMapper
import tools.jackson.module.kotlin.readValue

/**
* Class containing now-failing tests from [com.fasterxml.jackson.module.kotlin.test.github.TestGithub145],
* since "Rewrite Bean Property Introspection logic in Jackson 2.x #4515" from
* [jackson-databind#4515](https://github.com/FasterXML/jackson-databind/issues/4515) was completed.
*/
@Suppress("UNUSED_VARIABLE")
class Github145Failing {

private val objectMapper = jacksonObjectMapper()

// Cannot have companion object in class declared within function
class Person7 constructor(val preName: String, val lastName: String) {
private constructor(preNameAndLastName: String) : this(
preNameAndLastName.substringBefore(","),
preNameAndLastName.substringAfter(",")
)

companion object {
@JsonCreator
@JvmStatic
fun createFromJson(preNameAndLastName: String): Person7 {
return Person7(preNameAndLastName)
}
}
}

@Test
fun testPerson7() {
val person7Json = objectMapper.readValue<Person7>("""{"preName":"TestPreName","lastName":"TestLastname"}""")
}
}

0 comments on commit 81fdeb0

Please sign in to comment.