-
Notifications
You must be signed in to change notification settings - Fork 93
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
Add parameter-related coherent API methods #75
Conversation
I like the idea. One thing we should probably think through is whether to cache the list of |
Hi @mkouba I thought about this as well. My idea was to create all lists in constructors, but I dropped it because: 1) it seemed to be a bit redundant since we create it even if user won't use it, and 2) we pass |
I wouldn't consider this a problem.
Some of the jandex constructs are effectively immutable, i.e. the state is modified after it's created but before it's published.
+1 |
@mkouba Ok then, if you don't see it as a problem, then I won't too. I will send new patchset where I initialize these list in constructors. |
@mkouba Never mind :) I just tried and it's impossible to have all these lists cached. We can cache some, but not all. For example when I try to initialize the list in |
+1 It may also be useful for the |
#64 has a discussion of a similar API proposal. |
Superseded by #182. |
Hello Jandex Team!
Right now Jandex API for
MethodInfo
does not exposeMethodParameterInfo
directly. Some w/a for this limitation is to create custom class which acts the same way as theMethodParameterInfo
, but why do we have to reinvent the wheel if we can add missing methods directly in Jandex API.There were some discussions in quarkusio/quarkus#8054 and quarkusio/quarkus#2493 and this PR is to mitigate the root issue, i.e. it is to add missing methods in
MethodInfo
andMethodParameterInfo
classes and, as the result, make Jandex API more user friendly.@mkouba This is to address some of the problems we discussed in issues mentioned above.
To summarise. This PR adds the following methods:
MethodInfo.parametersList()
- list method parameters (infos not types)MethodInfo.methodAnnotations()
- list method annotations (without param annotations)MethodParameterInfo.annotations()
- list annotations defined on parameterMethodParameterInfo.annotation(DotName)
- get parameter annotation with given nameMethodParameterInfo.hasAnnotation(DotName)
- is parameter annotated with given annotationUnit tests included.
Please let me know in case of any issues.