Skip to content

Commit

Permalink
Short circuit if-conditions in AttributeMethods
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Feb 11, 2022
1 parent eca755e commit 4eaee1e
Showing 1 changed file with 4 additions and 3 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,6 +32,7 @@
* with consistent ordering as well as a few useful utility methods.
*
* @author Phillip Webb
* @author Sam Brannen
* @since 5.2
*/
final class AttributeMethods {
Expand Down Expand Up @@ -71,10 +72,10 @@ private AttributeMethods(@Nullable Class<? extends Annotation> annotationType, M
for (int i = 0; i < attributeMethods.length; i++) {
Method method = this.attributeMethods[i];
Class<?> type = method.getReturnType();
if (method.getDefaultValue() != null) {
if (!foundDefaultValueMethod && (method.getDefaultValue() != null)) {
foundDefaultValueMethod = true;
}
if (type.isAnnotation() || (type.isArray() && type.getComponentType().isAnnotation())) {
if (!foundNestedAnnotation && (type.isAnnotation() || (type.isArray() && type.getComponentType().isAnnotation()))) {
foundNestedAnnotation = true;
}
ReflectionUtils.makeAccessible(method);
Expand Down

0 comments on commit 4eaee1e

Please sign in to comment.