-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Problem deserializing some type of Enums when using PropertyNamingStrategy
#4302
Comments
Ok that does sound like a bug. Thank you for reporting it. And special thank you for including reproduction (unit test). |
@JooHyukKim Probably due to refactoring, hopefully there is an easy fix given it is easy to reproduce. |
By intution, I thought we would just skip renaming if target field is enum. |
Not ideal (conceptually), but yes that sound like a straight-forward way to do it. |
PTAL at #4311, @cowtowncoder ? |
PropertyNamingStrategy
@JooHyukKim Fix works here, but I wonder if it might have caused a new unit test failure for Ion backend: FasterXML/jackson-dataformats-binary#454 but I haven't yet had time to dig into whether test is at fault or change here. It could also be something completely different, but reference to Enum made me wonder. |
WIll look into it later today. After work, thank you for letting me know! @cowtowncoder |
The fix for this issue was incomplete... Made #4313. Could you please have a look @cowtowncoder ? |
Will look soon -- also realized the approach of the fix is wrong; I didn't think about it enough. I don't think it's super difficult to fix so when I get a chance I can tackle it too (didn't have time last night). |
Search before asking
Describe the bug
When using a mapper with a
PropertyNamingStrategy
configured, the following exception is thrown when trying to deserialize an enum that contains a field with the same name as one of the enum constants:It seems that now enum constants are also considered fields, which can clash with an enum's field when they are renamed. See also 2134584.
Version Information
2.16.1
Reproduction
Expected behavior
Similar to Jackson 2.15.3, I would expect this enum to be deserializable given we don't specify any mixins on the constants.
Additional context
The reproduction case above has a public field, but the issue is also apparent if the field is private and the following visibility is configured:
The text was updated successfully, but these errors were encountered: