Skip to content

fix: honor IgnoreSetNullValue in specialized FieldReader subclasses, for issue #7618#7631

Open
wenshao wants to merge 1 commit into
mainfrom
fix/issue-7618-ignore-set-null-value
Open

fix: honor IgnoreSetNullValue in specialized FieldReader subclasses, for issue #7618#7631
wenshao wants to merge 1 commit into
mainfrom
fix/issue-7618-ignore-set-null-value

Conversation

@wenshao
Copy link
Copy Markdown
Member

@wenshao wenshao commented Apr 25, 2026

Summary

  • The null-skip gate present in FieldReaderObject was missing from type-specialized FieldReader subclasses (FieldReaderString, boxed primitives, BigDecimal/BigInteger, Number, Date), so JSONReader.Feature.IgnoreSetNullValue was silently ignored for those fields — both when configured via @JSONType(deserializeFeatures = ...) and when passed at parse time.
  • Adds ignoreSetNullValue() helpers on FieldReader so the gate is reused consistently, and applies it in accept(T, Object) and readFieldValue(JSONReader, T) for the affected specialized readers.
  • ObjectReaderCreatorASM.genReadFieldValue:
    • extends the existing NullOnError fallback so it also falls back to fieldReader.readFieldValue when IgnoreSetNullValue is in fieldFeatures (annotation-driven case),
    • emits a runtime check on FEATURES for non-primitive fields on default-constructor beans, so the parse-time context feature also takes effect on the ASM hot path.
  • The NoneDefaultConstructor ASM 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

  • New Issue7618 test covering all four combinations: String / boxed primitives × annotation-level / context-level feature.
  • Existing related tests (Issue3789, Issue1745, Issue2164) still pass.
  • All 2189 Issue* regression tests pass.
  • All FieldReader* and ObjectReader*Test tests pass.

…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.
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IgnoreSetNullValue ignored by specialized FieldReader subclasses (FieldReaderString et al.)

2 participants