Open bmorris591 opened 4 months ago
This seems to occur without registering a KotlinModule
.
In the case of the code you submitted, the annotation is given as a constructor parameter.
At this time, databind
seems to ignore this annotation.
For example, this problem can be avoided by specifying @field:JsonProperty
.
I have submitted an issue to jackson-databind
regarding this behavior.
I'll see what functionality kotlin-module
should provide later.
https://github.com/FasterXML/jackson-databind/issues/4513
Just tracking this round the houses - it seems to have ended up as a Kotlin bug https://youtrack.jetbrains.com/issue/KT-67977
Some other context: Jackson 2.18 will finally get Property Introspection rewrite -- https://github.com/FasterXML/jackson-databind/issues/4515 -- completion of which should make it possible to address some problems that formerly could not, wrt Kotlin introspection. Not sure if it could help here but might well do so.
Search before asking
Describe the bug
When serialising the following Kotlin
data class
with2.16.1
I get the wrong properties generate. This works with2.15.4
.The following simple test code
Produces the following error
As you can see, the property is called
one
etc, notpropertyOne
.Removing
@JvmRecord
causes the test to pass. This works correctly with@JvmRecord
in2.15.4
.Versions
Java: GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30) Kotlin: 1.9.22 (
jvmTarget
21) Jackson BOM:2.16.1
To Reproduce
The above runs correctly if
@JvmRecord
2.15.4
Expected behavior
No response
Versions
Java: GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30) Kotlin: 1.9.22 Jackson-module-kotlin: 2.16.1 Jackson-databind: 2.16.1 Jackson-bom: 2.16.1
Additional context
Discovered when investigating Spring Boot 3.3.X