Skip to content

Introduce a way to indicate that an annotation needs to be visible at runtime #28470

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

Closed
snicoll opened this issue May 17, 2022 · 2 comments
Closed
Labels
status: declined A suggestion or change that we don't feel we should currently apply theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement

Comments

@snicoll
Copy link
Member

snicoll commented May 17, 2022

In a native image, an annotation will have no attributes until a dedicated hint is added, i.e.

{
    "name": "org.springframework.core.annotation.Order",
    "allDeclaredMethods": true
}

Without the above, the value attribute of Order is not available. Creating a process that handles all org.springframework annotations comes to mind, but there are a number of annotations that are build specific and should not be included. This includes anything configuration-class parsing related (such as @Configuration, @Bean, etc) and anything that has an explicit AOT handling that makes the annotation irrelevant at runtime.

Two ways comes to mind:

  • Meta-annotate the annotation to indicate it does not have to be visible at runtime.
  • Create a contract that contributions could implement to indicate the annotations that they handle.
@snicoll snicoll added type: enhancement A general enhancement theme: aot An issue related to Ahead-of-time processing labels May 17, 2022
@snicoll snicoll added this to the 6.0.0-M5 milestone May 17, 2022
@snicoll
Copy link
Member Author

snicoll commented May 19, 2022

Juergen and I chatted about this one and we're not sure if we want to create such a wide mechanism.

We feel that processing @Reflective-annotated annotations (see #28469) with a set of per-defined registrars for core concepts (web, etc) should cover quite some ground. We'll first give this a try and then figure out what we want to do here.

@snicoll
Copy link
Member Author

snicoll commented Jun 8, 2022

It looks like the above should work. If that turns out to be needed after all, we can reopen.

@snicoll snicoll closed this as not planned Won't fix, can't repro, duplicate, stale Jun 8, 2022
@snicoll snicoll added the status: declined A suggestion or change that we don't feel we should currently apply label Jun 8, 2022
@snicoll snicoll removed this from the 6.0.0-M5 milestone Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant