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

Allow non-boolean return type for "is-getters" with MapperFeature.ALLOW_IS_GETTERS_FOR_NON_BOOLEAN #3609

Merged

Conversation

Richie94
Copy link
Contributor

@Richie94 Richie94 commented Oct 3, 2022

On FasterXML/jackson-module-kotlin#575 we discovered, that through filtering of the returntype we got into the situation of completely skipping serializing a field.

Although its common to only have the syntax on writing is only in front of boolean getters, this seems to be a bit too heavy. I would propose, to get rid of this restriction.

@cowtowncoder
Copy link
Member

cowtowncoder commented Oct 4, 2022

This would change behavior significantly and possibly cause issues for existing users. I'd be happy to have a MapperFeature that controls this behavior (defaulting to old behavior for backwards compatibility), but not for simple change.
I realize this is not necessarily easy to achieve, but seems like something that is needed to avoid unwanted changes in behavior for some users.

EDIT: actually, change might not be super difficult.

@cowtowncoder cowtowncoder changed the title allow isGetters to have different type than boolean Allow non-boolean return type for "is-getters" with MapperFeature.ALLOW_IS_GETTERS_FOR_NON_BOOLEAN Oct 4, 2022
@cowtowncoder cowtowncoder merged commit 0809e7b into FasterXML:2.14 Oct 4, 2022
cowtowncoder added a commit that referenced this pull request Oct 4, 2022
@cowtowncoder
Copy link
Member

Excellent, thank you again @Richie94! This will go in 2.14.0-rc2 (and 2.14.0 final) and should be very welcome to most users.

I wonder whether Kotlin module should enable this by default?

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.

None yet

2 participants