Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Clarify that annotations can also be inherited from interfaces #278

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

jakub-bochenski
Copy link
Contributor

Solves #271

@jakub-bochenski
Copy link
Contributor Author

@cowtowncoder are there automated tests that verify this? Maybe linking them from the readme would be a good idea -- examples can help clarify doubts

@pjfanning
Copy link
Member

@jakub-bochenski feel free to contribute test cases yourself if this matters to you.

@jakub-bochenski
Copy link
Contributor Author

so this is not covered by any existing tests?

@pjfanning
Copy link
Member

so this is not covered by any existing tests?

Why is it up to me or anyone else to check this? The code is public. The code is written in plain Java and uses the junit test framework.

@cowtowncoder cowtowncoder merged commit 4fcd5b4 into FasterXML:2.19 Feb 7, 2025
@cowtowncoder
Copy link
Member

cowtowncoder commented Feb 7, 2025

@jakub-bochenski First of all, thank you for contributing the pr. This should be useful to help behavior.

As to testing: this repo/package has very little code (on purpose -- to minimize jar for use by value classes); the actual flattening/processing logic is in jackson-databind. I think most relevant code is in com.fasterxml.jackson.databind.introspect.

That repo also has a few tests (700+ test classes), some directly checking how annotation processing works, but more testing actual usage (esp. regression tests).
This is not an area where many bugs have been reported, fwtw, and functionality itself was implemented 10+ years ago -- some changes have been done to try to reduce overhead but very few logical changes. But it is rather stable functionality, which is why there have been few changes over the years.

So code involved is covered by tests, but test classes are spread around a few test packages; com.fasterxml.jackson.databind.type and com.fasterxml.jackson.databind.introspect at least.

As to coverage, you can see code coverage at

https://app.codecov.io/github/FasterXML/jackson-databind?branch=2.18

and specifically

https://app.codecov.io/github/FasterXML/jackson-databind/tree/master/src%2Fmain%2Fjava%2Fcom%2Ffasterxml%2Fjackson%2Fdatabind%2Fintrospect

@jakub-bochenski
Copy link
Contributor Author

Thanks, @cowtowncoder

On a quick look I cannot find any tests that would deal with annotations on interfaces.

I'm not really concerned about bugs -- in this context I'm thinking about tests as a form of documentation that is automatically verified.

Adding such tests doesn't seem very hard, but I don't have time to do this now.

@cowtowncoder
Copy link
Member

@jakub-bochenski That makes sense. Unfortunately tests are not structured/grouped in a way that is super clear, wrt. this particular aspect. There's also some conflation with low-level (flattening hierarchy of actual annotations) and higher-level processing (extracting actual semantics from known annotations via AnnotationIntrospector, which operates on flattened annotation info).

If you did want to dig deeper at some point, I think com.fasterxml.jackson.databind.introspect.AnnotatedClassResolver would be a good place to start, fwtw.

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.

3 participants