jackson-databind icon indicating copy to clipboard operation
jackson-databind copied to clipboard

BeanDeserializerModifier::updateBuilder doesn't work for immutable beans

Open herkrath opened this issue 5 months ago • 1 comments

Search before asking

  • [X] I searched in the issues and found nothing similar.

Describe the bug

Custom JsonDeserializers 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 JsonDeserializers 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.

herkrath avatar Feb 01 '24 19:02 herkrath

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)

cowtowncoder avatar Mar 12 '24 02:03 cowtowncoder