-
Notifications
You must be signed in to change notification settings - Fork 365
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
Expose meta annotation parameters in the LST #3504
Comments
@vlsi reported a practical use case for this particular issue in #3880 ; Copying that content here to close that issue.
|
Thanks again for logging this request @kmclarnon ; with this PR we should now capture annotation arguments from dependency classes. Edit: Pressed the wrong button on the close there; the above captures the annotation arguments; not clear yet if that's then available for meta annoations. |
What problem are you trying to solve?
Given a class structure like this
I would like to be able to determine what the
RetentionPolicy
being used for@A
is. For my particular use case this is necessary to determine whether a dependency is directly referenced in bytecode or not (so that we can fix the deps listed in the pom correctly) but I believe there are many situations where this might be useful.Describe the solution you'd like
I'm not sure I'm qualified to comment on what the ideal situation would be here, but it would be nice if there was a way to go from a
JavaType
that represented an annotation to a list ofJ.Annotation
s on that annotation rather than just a list ofJavaType.Class
.Eg something like
Have you considered any alternatives or workarounds?
The current workaround that I am moving forward with is to pass the classpath urls through from the build to the recipe execution so that a special recipe can use classgraph to find the full class information for the annotations I'm inspecting, but I don't believe this is portable to moderne's saas infrastructure as it requires that all of the dependency jars be available on the local filesystem during recipe execution.
Additional context
Related slack conversation: link
Are you interested in contributing this feature to OpenRewrite?
I would be willing to help with this feature but I do not believe I have enough context to propose the best solution here.
The text was updated successfully, but these errors were encountered: