Closed
Description
Christopher Rued opened SPR-16060 and commented
When scanning for annotations on a class that implements a generic interface where the generic
type is specified in the implementing class, annotation scanning would fail to identify annotations
from the interface since the parameter types do not match.
For example, given an interface:
public interface Foo<T> {
@Order
void foo(T t);
}
and a class:
public class StringFoo implements Foo<String> {
public void foo(String s) { ... }
}
when scanning StringFoo.foo for annotations, no annotations were identified.
This commit changes annotation scanning so that when scanning for annotations, the parameters are
compared for assignability (using Class.isAssignableFrom()) rather than requiring exact matches.
Original Issue: SEC-3081
Issue Links:
- Enable REST controller method parameter annotations on an interface [SPR-11055] #15682 Enable REST controller method parameter annotations on an interface
- AnnotationAwareOrderComparator does not work on proxied classes [SPR-10514] #15145 AnnotationAwareOrderComparator does not work on proxied classes
- Avoid repeated superclass introspection in AnnotationUtils.findAnnotation [SPR-16730] #21271 Avoid repeated superclass introspection in AnnotationUtils.findAnnotation
- Annotations on generic superclass methods not found by AnnotationUtils [SPR-17146] #21683 Annotations on generic superclass methods not found by AnnotationUtils
- Avoid unnecessary synthesizable annotation processing [SPR-16933] #21472 Avoid unnecessary synthesizable annotation processing
Referenced from: pull request #1553, and commits 23d4862, b72594d