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
Apply method predicate before searching type hierarchy
Prior to this commit, findMethods() and streamMethods() in
ReflectionSupport as well as findAnnotatedMethods() in
AnnotationSupport first searched for all methods in the type hierarchy
and then applied the user-supplied predicate (or "is annotated?"
predicate) afterwards.
This resulted in methods in subclasses incorrectly "shadowing"
package-private methods in superclasses (in a different package) even
if the predicate would otherwise exclude the method in such a subclass.
For example, given a superclass that declares a package-private static
@BeforeAll "before()" method and a subclass (in a different package)
that declares a @BeforeEach "before()" method, when JUnit Jupiter
looked up @BeforeAll methods for the subclass, the @BeforeAll
"before()" method in the superclass was not found because the
@BeforeEach "before()" method shadowed it based solely on the method
signature, ignoring the type of annotation sought.
To address that, this commit modifies the internal search algorithms in
ReflectionUtils so that method predicates are applied while searching
the hierarchy for methods.
Closes#3498Closes#3500
0 commit comments