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

Add AnnotationIntrospector.findRenameByField() to support Kotlin's "is-getter" naming convention #2527

Closed
cowtowncoder opened this issue Oct 26, 2019 · 2 comments
Milestone

Comments

@cowtowncoder
Copy link
Member

(note: follow up for FasterXML/jackson-module-kotlin#80)

So, Kotlin generates its property accessors, fields similar to (but not identical) Bean conventions:

https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html

and as a result Jackson's default introspection has some trouble, in particular for "is getters".
While there is now a patch for Kotlin, it might make sense to add a MapperFeature to enable it at lower level -- both for being bit more optimal, and to avoid possible regression when databind introspection changes in future (for 3.0 in particular).

@cowtowncoder cowtowncoder changed the title Add a new MapperFeature to support Kotlin's "is-getters" Add MapperFeature to support Kotlin's "is-getters" Oct 26, 2019
@cowtowncoder
Copy link
Member Author

Note: filed #2571 as something that might solve this with more general mechanism.

cowtowncoder added a commit that referenced this issue Dec 27, 2019
cowtowncoder added a commit that referenced this issue Dec 27, 2019
@cowtowncoder cowtowncoder changed the title Add MapperFeature to support Kotlin's "is-getters" Add AnnotationIntrospector.findRenameByField() to support Kotlin's "is-getter" naming convention Dec 28, 2019
@cowtowncoder
Copy link
Member Author

After wrestling with this for a bit -- trying not to add a new (too) specific MapperFeature, but also not wanting to add yet another handler for single use case either -- decided on something in-between: introduce a new introspection method in AnnotationIntrospector, with handling that does clean renaming, and a unit test that emulates how I think Kotlin runtime works.

Will need to verify with jackson-module-kotlin itself too, of course.

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

No branches or pull requests

1 participant