Overview
While writing tests for #35342, I noticed that we have a discrepancy in our "method override" detection in MergedAnnotations and AnnotatedMethod.
Specifically, the MergedAnnotations infrastructure supports finding annotations on methods that override non-public methods (such as a protected or package-private method in a superclass).
However, AnnotatedMethod will not find an annotation on a parameter in an overridden method unless the overridden method is public.
Example
If we remove the public modifier from the following declaration, the shouldFindAnnotationOnMethodParameterInGenericAbstractSuperclass() test in AnnotatedMethodTests will fail.
|
public abstract void processTwo(@Param C value); |
Related Issues
Overview
While writing tests for #35342, I noticed that we have a discrepancy in our "method override" detection in
MergedAnnotationsandAnnotatedMethod.Specifically, the
MergedAnnotationsinfrastructure supports finding annotations on methods that override non-public methods (such as aprotectedor package-private method in a superclass).However,
AnnotatedMethodwill not find an annotation on a parameter in an overridden method unless the overridden method ispublic.Example
If we remove the
publicmodifier from the following declaration, theshouldFindAnnotationOnMethodParameterInGenericAbstractSuperclass()test inAnnotatedMethodTestswill fail.spring-framework/spring-core/src/test/java/org/springframework/core/annotation/AnnotatedMethodTests.java
Line 106 in 5d325ca
Related Issues