This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit 69941d96c49f5ac552aea8630dd4f18c6821ebc8 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Dec 4 09:51:55 2021 -0500 Fix PMD: Avoid using a branching statement as the last in a loop. --- .../java/org/apache/commons/lang3/reflect/TypeUtils.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java index bb35fa2..aa854c3 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java @@ -1799,24 +1799,22 @@ public class TypeUtils { } /** - * Look up {@code var} in {@code typeVarAssigns} <em>transitively</em>, - * i.e. keep looking until the value found is <em>not</em> a type variable. + * Looks up {@code typeVariable} in {@code typeVarAssigns} <em>transitively</em>, i.e. keep looking until the value + * found is <em>not</em> a type variable. * * @param typeVariable the type variable to look up * @param typeVarAssigns the map used for the look up * @return Type or {@code null} if some variable was not in the map * @since 3.2 */ - private static Type unrollVariableAssignments(TypeVariable<?> typeVariable, - final Map<TypeVariable<?>, Type> typeVarAssigns) { + private static Type unrollVariableAssignments(TypeVariable<?> typeVariable, final Map<TypeVariable<?>, Type> typeVarAssigns) { Type result; do { result = typeVarAssigns.get(typeVariable); - if (result instanceof TypeVariable<?> && !result.equals(typeVariable)) { - typeVariable = (TypeVariable<?>) result; - continue; + if (!(result instanceof TypeVariable<?>) || result.equals(typeVariable)) { + break; } - break; + typeVariable = (TypeVariable<?>) result; } while (true); return result; }