fix: honor IgnoreSetNullValue in specialized FieldReader subclasses, for issue #7618#7631
Open
wenshao wants to merge 1 commit into
Open
fix: honor IgnoreSetNullValue in specialized FieldReader subclasses, for issue #7618#7631wenshao wants to merge 1 commit into
wenshao wants to merge 1 commit into
Conversation
…for issue #7618 The null-skip gate present in FieldReaderObject was missing from the type-specialized FieldReader subclasses (FieldReaderString, the boxed primitive variants, BigDecimal/BigInteger, Number, Date), so JSONReader.Feature.IgnoreSetNullValue was silently ignored for those fields whether configured via @JSONType.deserializeFeatures or passed at parse time. - FieldReader: add ignoreSetNullValue() helpers (field-level and field|context-level) so the gate can be reused consistently. - Specialized FieldReaders: skip the setter call when the parsed value is null and the feature is set. - ObjectReaderCreatorASM.genReadFieldValue: - Extend the existing NullOnError fallback to also fall back to fieldReader.readFieldValue when IgnoreSetNullValue is in fieldFeatures (annotation-driven). - For non-primitive fields on default-constructor beans, emit a runtime check on FEATURES so context-level IgnoreSetNullValue passed at parse time also takes effect.
|
wenshao seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FieldReaderObjectwas missing from type-specializedFieldReadersubclasses (FieldReaderString, boxed primitives,BigDecimal/BigInteger,Number,Date), soJSONReader.Feature.IgnoreSetNullValuewas silently ignored for those fields — both when configured via@JSONType(deserializeFeatures = ...)and when passed at parse time.ignoreSetNullValue()helpers onFieldReaderso the gate is reused consistently, and applies it inaccept(T, Object)andreadFieldValue(JSONReader, T)for the affected specialized readers.ObjectReaderCreatorASM.genReadFieldValue:NullOnErrorfallback so it also falls back tofieldReader.readFieldValuewhenIgnoreSetNullValueis infieldFeatures(annotation-driven case),FEATURESfor non-primitive fields on default-constructor beans, so the parse-time context feature also takes effect on the ASM hot path.NoneDefaultConstructorASM path uses temp locals (no OBJECT slot yet), so the runtime check is skipped there — that path needs a separate fix.Fixes #7618.
Test plan
Issue7618test covering all four combinations: String / boxed primitives × annotation-level / context-level feature.Issue3789,Issue1745,Issue2164) still pass.Issue*regression tests pass.FieldReader*andObjectReader*Testtests pass.