jackson-databind
jackson-databind copied to clipboard
BeanDeserializerModifier::updateBuilder doesn't work for immutable beans
Search before asking
- [X] I searched in the issues and found nothing similar.
Describe the bug
Custom JsonDeserializer
s set via BeanDeserializerModifier::updateBuilder
work for mutable beans only. They are ignored for immutable ones. This issue originates from #4351.
Version Information
At least 2.14 - 2.16.1, likely since much longer
Reproduction
Explanatory unit tests, as well as a potential fix, are part of my PR #4357.
Expected behavior
Custom JsonDeserializer
s set via BeanDeserializerModifier::updateBuilder
shall work for mutable and immutable beans.
Additional context
Note: My suggested fix does work for this very scenario and doesn't break any of the existing unit tests. However, it may not fix other, related issues with BeanDeserializerModifier
. Also, as I don't know every single Jackson feature and this part of the code is very delicate and complex, it may interfere with other features. Please review detailed.
Added failing test from #4357 -- timing-wise cannot fix for 2.17 due to release going out soon but depending on things might be possible for 2.17.x patch (if not, 2.18)