Closed Yaklede closed 2 weeks ago
Kotlin-related, will transfer to Kotlin module repo.
It is closed as a duplicate of #630
A possible solution is to enable KotrinPropertyNameAsImplicitName
.
.registerKotlinModule { enable(KotlinFeature.KotlinPropertyNameAsImplicitName) }
Search before asking
Describe the bug
Field proliferation bug when using ObjectMapper in Kotlin
Version Information
2.15.3
Reproduction
<-- Any of the following
Here is the class information as follows.
If you convert using objectMapper to JSON in this state, it will look like this.
I have found where the issue lies.
I was able to find the issue within the collectAll() method in the POJOPropertiesCollector.class.
In the following state, when the _addMethods() method is called, the number of properties increases to six.![image](https://github.com/FasterXML/jackson-databind/assets/68309983/fd34521b-2b09-4e4d-aa82-1c894dbd1160)
In my opinion, the issue seems to arise from the discrepancy between the names of the getter methods and the fields during the process of decompiling the Kotlin code into Java code.
I hope this bug report is helpful.
Expected behavior
No response
Additional context
No response