Skip to content

Fix #4983:@JsonTypeInfo location actual baseType via hierarchy#4988

Merged
cowtowncoder merged 6 commits intoFasterXML:3.xfrom
solven-eu:jsoninfotype/useAnnotationHolderAsBase
Mar 26, 2026
Merged

Fix #4983:@JsonTypeInfo location actual baseType via hierarchy#4988
cowtowncoder merged 6 commits intoFasterXML:3.xfrom
solven-eu:jsoninfotype/useAnnotationHolderAsBase

Conversation

@blacelle
Copy link
Copy Markdown
Contributor

@blacelle blacelle commented Feb 26, 2025

Fixes #4983.

@cowtowncoder cowtowncoder changed the title JsonInfoType Using annotationHolder as actual baseType for id as clas… JsonInfoType Using annotationHolder as actual baseType for id as className Mar 22, 2026
@cowtowncoder
Copy link
Copy Markdown
Member

@blacelle Ok, yes, although I wish traversal did not need to be done in AnnotationIntrospector, I suspect that is the way to go instead of huge refactoring trying to have more general mechanism.

So a new PR against 3.x would be good & I can help get that merged.
Thank you for your patience with this one.

@blacelle blacelle force-pushed the jsoninfotype/useAnnotationHolderAsBase branch from a9b6def to dcbc97c Compare March 23, 2026 04:17
@blacelle blacelle changed the base branch from 2.19 to 3.x March 23, 2026 04:17
@blacelle blacelle marked this pull request as ready for review March 23, 2026 04:18
@blacelle
Copy link
Copy Markdown
Contributor Author

@cowtowncoder This is rebased on 3.x and adjusted following review. Thanks

@github-actions
Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage
Instructions coverage 81.36%
Branches branches 74.62%

Coverage data generated from JaCoCo test results

@cowtowncoder cowtowncoder changed the title JsonInfoType Using annotationHolder as actual baseType for id as className @JsonTypeInfo location actual baseType via hierarchy Mar 24, 2026
Comment thread src/main/java/tools/jackson/databind/jsontype/impl/StdTypeResolverBuilder.java Outdated
Comment thread src/main/java/tools/jackson/databind/jsontype/TypeResolverProvider.java Outdated
Comment thread src/main/java/tools/jackson/databind/jsontype/TypeResolverProvider.java Outdated
@blacelle
Copy link
Copy Markdown
Contributor Author

BTW @cowtowncoder I have issues to run tests in some IDE (both Eclipse and Intellij) around JMPS/JDK9 modules. It's fine with 2.19 branch (probably not/less/different tests modules).

image

@blacelle blacelle force-pushed the jsoninfotype/useAnnotationHolderAsBase branch from 6d07ab5 to 62032a2 Compare March 24, 2026 07:51
@blacelle blacelle requested a review from cowtowncoder March 24, 2026 07:52
@cowtowncoder
Copy link
Copy Markdown
Member

@blacelle I also have problems running tests from Eclipse: need to use "Run Configurations" to select different JDK. I do see problem indicators for module-info.class but they do not appear to block running tests.
Maven from command-line has no problems running anything. :-/

@github-actions
Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 81.37% 📈 +0.010%
Branches branches 74.64% 📈 +0.000%

Coverage data generated from JaCoCo test results

Comment thread src/main/java/tools/jackson/databind/jsontype/impl/StdTypeResolverBuilder.java Outdated
@cowtowncoder
Copy link
Copy Markdown
Member

@blacelle Looks pretty good, only minor things to change. But aside from those, before I can merge this we'll need a CLA (unless you have sent one before). It needs to be sent just once before merging the first contribution and is good for all future prs.

Document is here: https://github.com/FasterXML/jackson/blob/main/CLA-jackson-2026.pdf
and the usual way is to print, fill & sign, scan/photo, email to cla at fasterxml dot com.

Looking forward to merging this; big thank you for contributing the pr!

@cowtowncoder cowtowncoder changed the title @JsonTypeInfo location actual baseType via hierarchy Fix #4983:@JsonTypeInfo location actual baseType via hierarchy Mar 25, 2026
@blacelle
Copy link
Copy Markdown
Contributor Author

@cowtowncoder CLA is sent. PR is progressed ; one element looks opinionated.

Thanks a lot, the contribution experience is quite smooth.

@cowtowncoder cowtowncoder added the cla-received PR already covered by CLA (optional label) label Mar 25, 2026
@github-actions
Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 81.37% 📈 +0.000%
Branches branches 74.64% 📈 +0.000%

Coverage data generated from JaCoCo test results

Copy link
Copy Markdown
Member

@cowtowncoder cowtowncoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, just minor Javadoc additions needed.

@blacelle
Copy link
Copy Markdown
Contributor Author

Done. I also restored the StdTypeResolverBuilder(JsonTypeInfo.Value settings) constructor.

@github-actions
Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 81.36% 📈 +0.010%
Branches branches 74.63% 📈 +0.010%

Coverage data generated from JaCoCo test results

Comment thread src/main/java/tools/jackson/databind/jsontype/impl/StdTypeResolverBuilder.java Outdated
@blacelle blacelle requested a review from cowtowncoder March 26, 2026 19:22
@github-actions
Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 81.36% 📈 +0.010%
Branches branches 74.63% 📈 +0.010%

Coverage data generated from JaCoCo test results

@cowtowncoder cowtowncoder added this to the 3.2.0 milestone Mar 26, 2026
@cowtowncoder cowtowncoder merged commit 590acf6 into FasterXML:3.x Mar 26, 2026
6 checks passed
@@ -297,7 +312,7 @@ protected TypeResolverBuilder<?> _findTypeResolver(MapperConfig<?> config,
}

protected TypeResolverBuilder<?> _constructStdTypeResolverBuilder(MapperConfig<?> config,
Copy link
Copy Markdown
Member

@cowtowncoder cowtowncoder Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whops. Change of this signature broke XML backend: will patch.

(granted, sub-classing and overriding protected method not clean extension but....

cowtowncoder added a commit that referenced this pull request Mar 27, 2026
cowtowncoder added a commit that referenced this pull request Mar 27, 2026
@blacelle blacelle deleted the jsoninfotype/useAnnotationHolderAsBase branch May 3, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.2 cla-received PR already covered by CLA (optional label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JsonTypeInfo.Id.MINIMAL_CLASS generates invalid type on sub-package

2 participants