Skip to content

Add copy constructor for JacksonAnnotationIntrospector - #6231

Merged
cowtowncoder merged 2 commits into
3.xfrom
claude/3.x/jackson-annotation-introspector-copy-constructor
Sep 23, 2026
Merged

cowtowncoder merged 2 commits into
3.xfrom
claude/3.x/jackson-annotation-introspector-copy-constructor

Conversation

@cowtowncoder

Copy link
Copy Markdown
Member

Adds protected JacksonAnnotationIntrospector(JacksonAnnotationIntrospector src) copy constructor (since 3.3), which copies all configuration settings of src (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 copy JacksonAnnotationIntrospector settings by hand, and would silently miss any setting added later.

The motivating case is FasterXML/jackson-dataformat-xml#913, where XmlMapper.Builder.defaultUseWrapper() modified a JacksonXmlAnnotationIntrospector shared 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

cowtowncoder and others added 2 commits September 22, 2026 18:57
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>
@gitar-bot

gitar-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Adds subclass copy construction that propagates introspector configuration but excludes caches.

Adds a protected copy constructor for JacksonAnnotationIntrospector that copies configuration settings while maintaining independent cached state, enabling subclasses to create reconfigured copies without affecting shared instances. Test coverage confirms settings are properly copied and caches remain independent. No issues found.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@cowtowncoder cowtowncoder added this to the 3.3.0 milestone Sep 23, 2026
@cowtowncoder
cowtowncoder merged commit 6c91ad3 into 3.x Sep 23, 2026
5 checks passed
@cowtowncoder
cowtowncoder deleted the claude/3.x/jackson-annotation-introspector-copy-constructor branch September 23, 2026 01:59
@github-actions

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 82.36% 📈 +0.010%
Branches branches 75.94% 📉 -0.010%

Coverage data generated from JaCoCo test results

@github-actions

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 82.36% 📈 +0.010%
Branches branches 75.96% 📈 +0.010%

Coverage data generated from JaCoCo test results

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.

1 participant