-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expose findAnnotated* in public API #4925
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
Comments
@Berstanio is this issue still relevant. Would native-image support for libgdx benefit from exposing findAnnotated{Classes,Methods,Fields} as public API (lifting the methods to |
Hi @olpaw, On a related note, libGDX also currently depends on the |
I thought classpath scanning was going to be removed, which would make these internal calls impossible and they would be removed? And that's why they would not be exposed to the public API. Our use-case is similar to that of @Berstanio in that we have marker annotations that require reflection configuration, including all subclasses so for us as well, the |
That is correct. In the long run classpath scanning will be removed and thus we cannot expose
which allows users to query annotation information without causing side-effecting changes that impact the analysis results. Together with
feature implementers can implement their own variants of |
@Berstanio you can replace that with something even better. We have subtype reachability handlers. See: |
That is sadly the crucial downside, that makes this unsuitable. Imagine this case: class Animation {
private AnimationTransformer transformer;
}
|
I see. The static analysis will not see the Animation subclasses to ever get instantiated because they only come into existence via de-serialization. Ideally there would it be a static method in libgdx that returns all Animation subclasses. With that, your feature could use it to call |
Would it be possible to expose these calls anyway, but make it lazilly initialized? That way we can rely on GraalVM to do the actual scan, and avoid issues with e.g. the AnnotationAccess stuff, because using the |
Feature request
I would like to implement a Feature to resolve all classes, which are marked with a special Annotation. As far as I see it there is straight forward way to get all classes / interfaces, which would provide such capabilities.
Describe the solution you'd like.
After some searching I found following public methods, which are implemented in the Feature-Impl. I would like to make following methods to be publicly available in the Feature-Interface
FeatureImpl.FeatureAccessImpl
Describe who do you think will benefit the most.
Devs, which implement Features based upon certain Annotations
Describe alternatives you've considered.
Accessing the impl classes by casting / reflection does not work due to not being exported
An alternative would be using an external library, which seems to work
Additional context.
/
Express whether you'd like to help contributing this feature
I could make them public in a backwards compatible way, but it is up to the team whether my proposal has some merits. It seems it was a concise decision to NOT expose it via the interface.
If there is another way to get all classes, fields, methods, which are marked with a Annotation please provide an alternative solution and close this issue.
The text was updated successfully, but these errors were encountered: