File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
spring-core/src/main/java/org/springframework/core/annotation Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1818
1919import java .lang .annotation .Annotation ;
2020import java .lang .reflect .Method ;
21+ import java .lang .reflect .Modifier ;
2122import java .util .ArrayList ;
2223import java .util .Arrays ;
2324import java .util .List ;
3839 * interface-declared parameter annotations from the concrete target method.
3940 *
4041 * @author Juergen Hoeller
42+ * @author Sam Brannen
4143 * @since 6.1
4244 * @see #getMethodAnnotation(Class)
4345 * @see #getMethodParameters()
@@ -181,7 +183,7 @@ private List<Annotation[][]> getInheritedParameterAnnotations() {
181183 clazz = null ;
182184 }
183185 if (clazz != null ) {
184- for (Method candidate : clazz .getMethods ()) {
186+ for (Method candidate : clazz .getDeclaredMethods ()) {
185187 if (isOverrideFor (candidate )) {
186188 parameterAnnotations .add (candidate .getParameterAnnotations ());
187189 }
@@ -194,8 +196,9 @@ private List<Annotation[][]> getInheritedParameterAnnotations() {
194196 }
195197
196198 private boolean isOverrideFor (Method candidate ) {
197- if (!candidate .getName ().equals (this .method .getName ()) ||
198- candidate .getParameterCount () != this .method .getParameterCount ()) {
199+ if (Modifier .isPrivate (candidate .getModifiers ()) ||
200+ !candidate .getName ().equals (this .method .getName ()) ||
201+ (candidate .getParameterCount () != this .method .getParameterCount ())) {
199202 return false ;
200203 }
201204 Class <?>[] paramTypes = this .method .getParameterTypes ();
You can’t perform that action at this time.
0 commit comments