Add copy constructor for JacksonAnnotationIntrospector - #6231
Merged
cowtowncoder merged 2 commits intoSep 23, 2026
Merged
cowtowncoder merged 2 commits into
cowtowncoder merged 2 commits into
Conversation
Allows sub-classes to create re-configured copies (instead of modifying instances that may be shared by multiple mappers) without having to copy settings of `JacksonAnnotationIntrospector` by hand. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Code Review ✅ Approved🟡 Medium risk · Adds subclass copy construction that propagates introspector configuration but excludes caches. Adds a protected copy constructor for OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
cowtowncoder
deleted the
claude/3.x/jackson-annotation-introspector-copy-constructor
branch
September 23, 2026 01:59
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.
Adds
protected JacksonAnnotationIntrospector(JacksonAnnotationIntrospector src)copy constructor (since 3.3), which copies all configuration settings ofsrc(currently_cfgConstructorPropertiesImpliesCreator), but not cached state (_annotationsInside).Why
Sub-classes that need to create re-configured copies — instead of modifying an introspector in place, which also affects every mapper already using it (including ones created via
rebuild()) — currently have to copyJacksonAnnotationIntrospectorsettings by hand, and would silently miss any setting added later.The motivating case is FasterXML/jackson-dataformat-xml#913, where
XmlMapper.Builder.defaultUseWrapper()modified aJacksonXmlAnnotationIntrospectorshared with the original mapper; its new copy constructor can delegate to this one once available.Tests
JacksonAnnotationIntrospectorTest.testCopyConstructor: setting is copied (both values), copy has its own cache, and is independent of source.🤖 Generated with Claude Code