Make annotation inheritance resolution available to components
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 400
- Forks
- 143
- PR merge metrics
- No merged PRs in 30d
Description
The specification currently defines annotation inheritance in chapter 3.6:
> JAX-RS annotations may be used on the methods and method parameters of a super-class or an implemented interface. Such annotations are inherited by a corresponding sub-class or implementation class method provided that the method and its parameters do not have any JAX-RS annotations of their own. Annotations on a super-class take precedence over those on an implemented interface. The precedence over conflicting annotations defined in multiple implemented interfaces is implementation specific. Note that inheritance of class or interface annotations is not supported.
As an implementor of components (in particular of filters) I often have the need to follow the above rules when defining *custom* annotations. From the view of an application vendor, it makes sense that my custom annotations behave just like JAX-RS annotations. So for each filter I have to write rather lengthy code which implements the above rules to find my custom annotations on methods of interfaces and super classes, too, but skips them as soon as *any* JAX-RS annotation is found on the resource method itself. This is tedious, and as the algorithm is always the same, I wonder why all filter vendors shall repeat that algorithm again and again.
Hence I would like to start a discussion whether a runtime could open its annotation inheritance resolution to components.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the annotation inheritance rules in specification chapter 3.6 and review how components, especially filters, currently access custom annotations. Define the runtime API and precedence behavior needed to expose the same method and parameter resolution, including when JAX-RS annotations suppress inherited custom annotations; the issue remains a design discussion rather than a defined implementation task.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100