Repository navigation
Afterburner: honor active JSON View in fast paths, fix truncated update input and native Object Id NPE - #371
Merged
Conversation
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>
_useVanillaProcessing(ctxt) for fast path checks_useVanillaProcessing(ctxt) for fast path checks (sync with 3.3.0 of jackson-databind)
- 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>
_useVanillaProcessing(ctxt) for fast path checks (sync with 3.3.0 of jackson-databind)Exact type depends on databind version, see [databind#6376]. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-up to FasterXML/jackson-databind#6224 (fix for databind issue 6219), after which
_vanillaProcessingno longer takes JSON Views into account.SuperSonicBeanDeserializerandSuperSonicUnrolledDeserializerchecked the flag directly, so they ignored the active view and set properties it excludes.DeserializeWithViewTest.testReaderWithViewfails 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
deserialize()overloads of the two deserializers, now call_useVanillaProcessing(ctxt).super.deserialize(p, ctxt, bean)on a name miss. For a token stream ending beforeEND_OBJECT, for example from aTokenBuffer, that returned a partly updated bean where stock throwsMismatchedInputException. They now call_deserializeDisordered(), as the other misses do._handleTypedObjectId()for any native id in the input, such as a YAML anchor, on a bean that doesn't use Object Ids._objectIdReaderis always null there, so this threw an NPE where stock ignores the id. The block is removed._objectIdReader,_nonStandardCreation,_injectables,_unwrappedPropertyHandlerand_externalTypeIdHandlerthat follow the guard._vanillaProcessingalready rules these out once the deserializer is resolved.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.ViewDeserializationInjectionTestandTruncatedInputInjectionTest(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
MismatchedInputExceptionjackson-databind#6376Stringvalues get aDatabindExceptionwrapping an NPE, and with it aMismatchedInputException. The tests assertDatabindException, which covers both, and can be tightened once #6376 is in a snapshot.Testing
afterburnerandafterburner-testspass 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