Skip to content

Make BeanDeserializer consider DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES to avoid buffering #3643

@cowtowncoder

Description

@cowtowncoder

Currently BeanDeserializer has _ignoreAllUnknown flag but it is only set if per-class annotation @JsonIgnoreProperties(ignoreUnknown = true) (or its ConfigOverride equivalent) is specified.
This flag is used to optimize handling to skip buffering for unknown properties; it would make sense to make it also consider that if DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES is disabled, property value need not be buffered.

It'd be good to test detection as well to ensure we know how settings work; perhaps by checking how BeanDeserializerBuilder works.

Note that we might want to do dynamic check for the flag, instead of modifying _ignoreAllUnknown: this because DeserializationFeatures may be changed on per-call basis (and since it can, inevitably someone will :) ).
And since the case of buffering seemingly unknown property value is presumably rare, minor overhead for feature-flag check is probably fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.0Issue planned for initial 3.0 release3.0-release-notesIssues relevant for 3.0 release notes.performanceIssue related to performance problems or enhancements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions