Skip to content

Conversation

@JacksonJang
Copy link
Contributor

Issue: #1037

Previously, @JsonIgnoreProperties annotations didn't stack across inheritance hierarchies.
When both a parent class and child class had @JsonIgnoreProperties annotations, only the child's annotation was recognized, ignoring the parent's configuration entirely.

So, I fixed this by collecting ignored property names into ignoreNames and merging them using withIgnored().

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 78.50% 📈 +0.010%
Branches branches 72.01% 📈 +0.020%

Coverage data generated from JaCoCo test results

@cowtowncoder
Copy link
Member

While this could work for specific annotation (esp. if handling of interfaces was added), it:

  1. Would require separate handling for every annotation type
  2. Would not take mix-in annotations into account
  3. Would only support Jackson annotations (but not like JAXB annotations via module)

so I don't want to approach the problem this way. AnnotatedClass is what handles resolution and flattening (or whatever constructs AnnotatedClass), and that's where more general handling should live.

@JacksonJang
Copy link
Contributor Author

Thank you for the detailed explanation.

It makes sense that the solution should be implemented at the AnnotatedClass level for a more general approach.

I'll give it another try.

@github-actions
Copy link

github-actions bot commented Jan 9, 2026

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 78.53% 📈 +0.000%
Branches branches 72.04% 📉 -0.020%

Coverage data generated from JaCoCo test results

@JacksonJang
Copy link
Contributor Author

@cowtowncoder
I have rolled back the changes related to findPropertyIgnoralByName in JacksonAnnotationIntrospector.

Instead, I've added tryMergeClassAnnotation in AnnotationIntrospector and moved the related logic there.
The intention is to make the design more extensible, so that additional annotations can be handled in a centralized way if more are added to JacksonAnnotationIntrospector in the future.(check TODO note)

I would appreciate it if you could take a look when you have time.
Thank you!

@cowtowncoder
Copy link
Member

cowtowncoder commented Jan 9, 2026

@JacksonJang Very interesting! It is closer to something acceptable but I need to think carefully.

Another further approach would be to see if it was possible to extend Annotation types to contain merge functionality (method) as part interface they'd implement.

EDIT: never mind, annotation types cannot implement interfaces, nor define parameter-taking methods.

@JacksonJang
Copy link
Contributor Author

Thank you for taking the time to think this through.

Agreed -- that's a limitation of Java annotations.

My intent was to keep the merge logic generic at the AnnotationIntrospector level,
rather than per-annotation handling in JacksonAnnotationIntrospector,

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.

2 participants