Skip to content

Afterburner: honor active JSON View in fast paths, fix truncated update input and native Object Id NPE - #371

Merged
cowtowncoder merged 4 commits into
3.xfrom
fix-afterburner-use-vanilla-processing
Nov 2, 2026
Merged

cowtowncoder merged 4 commits into
3.xfrom
fix-afterburner-use-vanilla-processing

Conversation

@cowtowncoder

@cowtowncoder cowtowncoder commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Follow-up to FasterXML/jackson-databind#6224 (fix for databind issue 6219), after which _vanillaProcessing no longer takes JSON Views into account. SuperSonicBeanDeserializer and SuperSonicUnrolledDeserializer checked the flag directly, so they ignored the active view and set properties it excludes. DeserializeWithViewTest.testReaderWithView fails on current databind without this change.

Blackbird needs no change: it never reads the flag. Its generated code checks ctxt.getActiveView() per call, and its other paths use stock databind code.

Changes

  • View fix: all four checks, in both deserialize() overloads of the two deserializers, now call _useVanillaProcessing(ctxt).
  • Truncated input on update: three fallbacks in the update fast paths called super.deserialize(p, ctxt, bean) on a name miss. For a token stream ending before END_OBJECT, for example from a TokenBuffer, that returned a partly updated bean where stock throws MismatchedInputException. They now call _deserializeDisordered(), as the other misses do.
  • NPE on native Object Ids: the read fast paths called _handleTypedObjectId() for any native id in the input, such as a YAML anchor, on a bean that doesn't use Object Ids. _objectIdReader is always null there, so this threw an NPE where stock ignores the id. The block is removed.
  • Dead code: removed the checks for _objectIdReader, _nonStandardCreation, _injectables, _unwrappedPropertyHandler and _externalTypeIdHandler that follow the guard. _vanillaProcessing already rules these out once the deserializer is resolved.
  • Comments: corrected "should we ever get here?", since that branch is the regular route for an active view, and clarified the comment on the slow-path call.

Tests

  • DeserializeWithViewTest: updating an existing bean and an 8-property bean, with and without a view, plus a check of which deserializer each bean gets.
  • TruncatedInputTest (new): truncated streams on read and update, truncation right after a property name, partial and out-of-order input, for narrow and wide beans.
  • NativeObjectIdOnPojoTest (new): a native Object Id on a plain bean is ignored, by stock and Afterburner.
  • ViewDeserializationInjectionTest and TruncatedInputInjectionTest (new, afterburner-tests): views and truncation with generated mutators, which the in-tree tests can't reach because injection is disabled in a named module.

The with-view, truncated-update and native Object Id tests fail when the matching fixes are reverted.

Compatibility notes

  • Under 3.x defaults the flag used to be false for every bean, so Afterburner's fast paths almost never ran. They now run by default whenever no view is active.
  • For a stream truncated right after a property name, Afterburner fails the same way as stock. The exception type depends on the databind version: before Report end of input after property name as MismatchedInputException jackson-databind#6376 String values get a DatabindException wrapping an NPE, and with it a MismatchedInputException. The tests assert DatabindException, which covers both, and can be tightened once #6376 is in a snapshot.

Testing

afterburner and afterburner-tests pass locally against a databind snapshot that includes #6224. Blackbird passed on JDK 25 with the first commit; the later commits don't touch it.

🤖 Generated with Claude Code

Since [databind#6219] `_vanillaProcessing` no longer takes JSON Views into
account, so checking the flag directly made SuperSonic deserializers ignore
the active view and set properties it excludes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cowtowncoder cowtowncoder changed the title Afterburner: use _useVanillaProcessing(ctxt) for fast path checks Afterburner: use _useVanillaProcessing(ctxt) for fast path checks (sync with 3.3.0 of jackson-databind) Nov 2, 2026
@cowtowncoder cowtowncoder added this to the 3.3.0 milestone Nov 2, 2026
cowtowncoder and others added 2 commits November 1, 2026 17:45
- Update fast paths used `super.deserialize()` on a name miss, which accepts
  a token stream ending before END_OBJECT and returns a partly updated bean;
  use `_deserializeDisordered()`, as the other misses do
- Remove checks that `_useVanillaProcessing()` already rules out, and correct
  the comment that treated the fallback as unexpected
- Add view tests for generated mutators in `afterburner-tests`, and verify
  which deserializer the in-tree view tests exercise

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Read fast paths called `_handleTypedObjectId()` for any native Object Id in
input, such as a YAML anchor, but `_objectIdReader` is always null past the
vanilla check: this caused an NPE where stock ignores the id.

Also extend truncated input tests to the read path, truncation right after a
property name (including generated mutators) and partial updates; verify test
setup first in `ViewDeserializationInjectionTest`; clarify a comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cowtowncoder cowtowncoder changed the title Afterburner: use _useVanillaProcessing(ctxt) for fast path checks (sync with 3.3.0 of jackson-databind) Afterburner: honor active JSON View in fast paths, fix truncated update input and native Object Id NPE Nov 2, 2026
Exact type depends on databind version, see [databind#6376].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cowtowncoder
cowtowncoder merged commit fcb9aae into 3.x Nov 2, 2026
4 checks passed
@cowtowncoder
cowtowncoder deleted the fix-afterburner-use-vanilla-processing branch November 2, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant