You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Annotations on generic interface methods not found by AnnotationUtils [SPR-16060] #20609
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.
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.
Just following up, since I haven't seen any activity. This can cause some surprising bugs that are hard to notice. Let me know if you need any changes in the pull request.
It turns out that #21271 makes this straightforward and efficient to implement, so I'll even backport this to 5.0.8. The pain is that an assignability check is not sufficient here; we'll have to go through generics resolution for the type variable to make sure that our concrete method actually overrides the given interface methods (i.e. that it is not just an overloaded variant of it).
Activity
spring-projects-issues commentedon Oct 11, 2017
Christopher Rued commented
PR #1553
spring-projects-issues commentedon Feb 16, 2018
Christopher Rued commented
Just following up, since I haven't seen any activity. This can cause some surprising bugs that are hard to notice. Let me know if you need any changes in the pull request.
spring-projects-issues commentedon Jul 18, 2018
Juergen Hoeller commented
It turns out that #21271 makes this straightforward and efficient to implement, so I'll even backport this to 5.0.8. The pain is that an assignability check is not sufficient here; we'll have to go through generics resolution for the type variable to make sure that our concrete method actually overrides the given interface methods (i.e. that it is not just an overloaded variant of it).