You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Self-referencing type with property-level @JsonIdentityInfo: nested value misses settings applied later in resolve() #6359
When a type refers to itself through a property with property-level @JsonIdentityInfo, the contextual (Object Id) deserializer for that property is created while the type's own deserializer is still inside BeanDeserializerBase.resolve(). withObjectIdReader() takes a copy of the BeanPropertyMap at that point. So changes resolve() makes to properties after the self-referencing one (null handling, managed/back references, and so on) are applied only to the original map, not to the copy used for nested values.
Before #6358 (fix for #6352) this case failed outright with NoSuchElementException: No entry 'next' found, can't replace, because the map was modified in place. After #6358 it no longer fails, but nested values are deserialized without those settings.
@JsonPropertyOrder({"id", "next", "z"})
staticclassNode {
publicintid;
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
publicNodenext;
@JsonSetter(nulls = Nulls.FAIL)
publicStringz;
}
ObjectMappermapper = JsonMapper.shared();
// fails as expected with `InvalidNullException`:mapper.readValue(""" {"id":1,"z":null} """, Node.class);
// does NOT fail: `Nulls.FAIL` is not applied to the nested valuemapper.readValue(""" {"id":1,"next":{"id":2,"z":null}} """, Node.class);
Expected behavior
Nested Node (via next) uses the same property settings as the root Node, so the second call also fails with InvalidNullException.
Notes
_contextualizeProperties() (from #1755) re-contextualizes value deserializers of the copy, but does not re-apply the other per-property changes from resolve(). A possible fix is to defer the Object Id copy, or to rebuild it once resolve() has finished.
Activity
havefunatcode commentedon Nov 5, 2026
Is anyone working on this? If not, I'd like to give it a try.
Do not modify shared property map of contextual copy, add more tests …
cowtowncoder commentedon Nov 5, 2026
@havefunatcode I don't think anyone is so go ahead (like you did it looks like)
Target 3.4.0 for FasterXML#6359: move release note, add credit, update …
Use try/finally for FasterXML#6359 resolve tracking, note array-shape…
Remove FasterXML#1755 re-contextualization code, superseded by Faster…