-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Currently getParameterAnnotations(Method method) of the ReflectionUtils only checks the direct superclass for futher parameter annotations. If the method is overridden more than once, annotations wont be found if they are not declared in the declaring class of the method or its direct superclass.
Current Implementation:
public static Annotation[][] getParameterAnnotations(Method method) {
Annotation[][] methodAnnotations = method.getParameterAnnotations();
Method overriddenmethod = getOverriddenMethod(method);
if (overriddenmethod != null) {
Annotation[][] overriddenAnnotations = overriddenmethod
.getParameterAnnotations();
for (int i = 0; i < methodAnnotations.length; i++) {
List<Type> types = new ArrayList<>();
for (int j = 0; j < methodAnnotations[i].length; j++) {
types.add(methodAnnotations[i][j].annotationType());
}
for (int j = 0; j < overriddenAnnotations[i].length; j++) {
if (!types.contains(overriddenAnnotations[i][j]
.annotationType())) {
methodAnnotations[i] = ArrayUtils.add(
methodAnnotations[i],
overriddenAnnotations[i][j]);
}
}
}
}
return methodAnnotations;
}
I will link a pull request that can solve this issue.
Metadata
Metadata
Assignees
Labels
No labels