jakartaee / jakartaee/rest

Make annotation inheritance resolution available to components

Open
#968 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement spec
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.