Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix serialization of is properties #427

Closed
wants to merge 1 commit into from
Closed

Conversation

dinomite
Copy link
Member

No description provided.

@dinomite dinomite changed the base branch from master to 2.12 March 11, 2021 23:48
@dinomite dinomite changed the title Use member name if it is a Kotlin-generated method Fix serialization of is properties Mar 11, 2021
@@ -32,6 +38,10 @@ internal class KotlinNamesAnnotationIntrospector(val module: KotlinModule, val c
member.parameterCount == 0) {
return member.name.substringAfter("is").decapitalize().substringBefore('-')
}
} else if (member is AnnotatedMethod && member.declaringClass.isKotlinClass()) {
if (cache.isKotlinGeneratedMethod(member) { it.declaringClass.declaredFields.any { f -> f.name == member.name } }) {
return member.name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another possibility would be to implement com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy (or maybe extend DefaultAccessorNamingStrategy impl) and define findNameForXxx().
But not sure if that would necessarily be any simpler (it could be more efficient as names of all fields, methods could be done just once when creating instance but that's probably not a big deal).

@k163377
Copy link
Contributor

k163377 commented Sep 17, 2023

This PR is closed because of the modifications made in #641 regarding properties starting with is.

@k163377 k163377 closed this Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants