Skip to content

Commit 4eaee1e

Browse files
committed
Short circuit if-conditions in AttributeMethods
1 parent eca755e commit 4eaee1e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

spring-core/src/main/java/org/springframework/core/annotation/AttributeMethods.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@
3232
* with consistent ordering as well as a few useful utility methods.
3333
*
3434
* @author Phillip Webb
35+
* @author Sam Brannen
3536
* @since 5.2
3637
*/
3738
final class AttributeMethods {
@@ -71,10 +72,10 @@ private AttributeMethods(@Nullable Class<? extends Annotation> annotationType, M
7172
for (int i = 0; i < attributeMethods.length; i++) {
7273
Method method = this.attributeMethods[i];
7374
Class<?> type = method.getReturnType();
74-
if (method.getDefaultValue() != null) {
75+
if (!foundDefaultValueMethod && (method.getDefaultValue() != null)) {
7576
foundDefaultValueMethod = true;
7677
}
77-
if (type.isAnnotation() || (type.isArray() && type.getComponentType().isAnnotation())) {
78+
if (!foundNestedAnnotation && (type.isAnnotation() || (type.isArray() && type.getComponentType().isAnnotation()))) {
7879
foundNestedAnnotation = true;
7980
}
8081
ReflectionUtils.makeAccessible(method);

0 commit comments

Comments
 (0)