PMD: Remove extra parens

This commit is contained in:
Gary Gregory 2022-08-26 14:29:24 -04:00
parent dafea75722
commit 7cb81aa26f
4 changed files with 10 additions and 10 deletions

View File

@ -2478,7 +2478,7 @@ public class ArrayUtils {
final boolean searchNaN = Double.isNaN(valueToFind); final boolean searchNaN = Double.isNaN(valueToFind);
for (int i = startIndex; i < array.length; i++) { for (int i = startIndex; i < array.length; i++) {
final double element = array[i]; final double element = array[i];
if (valueToFind == element || (searchNaN && Double.isNaN(element))) { if (valueToFind == element || searchNaN && Double.isNaN(element)) {
return i; return i;
} }
} }
@ -2562,7 +2562,7 @@ public class ArrayUtils {
final boolean searchNaN = Float.isNaN(valueToFind); final boolean searchNaN = Float.isNaN(valueToFind);
for (int i = startIndex; i < array.length; i++) { for (int i = startIndex; i < array.length; i++) {
final float element = array[i]; final float element = array[i];
if (valueToFind == element || (searchNaN && Float.isNaN(element))) { if (valueToFind == element || searchNaN && Float.isNaN(element)) {
return i; return i;
} }
} }

View File

@ -2756,7 +2756,7 @@ public class StringUtils {
final char ch = cs.charAt(i); final char ch = cs.charAt(i);
for (int j = 0; j < searchLen; j++) { for (int j = 0; j < searchLen; j++) {
if (searchChars[j] == ch) { if (searchChars[j] == ch) {
if ((i >= csLast) || (j >= searchLast) || !Character.isHighSurrogate(ch)) { if (i >= csLast || j >= searchLast || !Character.isHighSurrogate(ch)) {
return i; return i;
} }
// ch is a supplementary character // ch is a supplementary character
@ -2889,7 +2889,7 @@ public class StringUtils {
final char ch = cs.charAt(i); final char ch = cs.charAt(i);
for (int j = 0; j < searchLen; j++) { for (int j = 0; j < searchLen; j++) {
if (searchChars[j] == ch) { if (searchChars[j] == ch) {
if ((i >= csLast) || (j >= searchLast) || !Character.isHighSurrogate(ch)) { if (i >= csLast || j >= searchLast || !Character.isHighSurrogate(ch)) {
continue outer; continue outer;
} }
if (searchChars[j + 1] == cs.charAt(i + 1)) { if (searchChars[j + 1] == cs.charAt(i + 1)) {
@ -5486,7 +5486,7 @@ public class StringUtils {
whitespacesCount++; whitespacesCount++;
} else { } else {
startWhitespaces = false; startWhitespaces = false;
newChars[count++] = (actualChar == 160 ? 32 : actualChar); newChars[count++] = actualChar == 160 ? 32 : actualChar;
whitespacesCount = 0; whitespacesCount = 0;
} }
} }
@ -6636,7 +6636,7 @@ public class StringUtils {
} }
} }
if (isEmpty(text) || ArrayUtils.isEmpty(searchList) || ArrayUtils.isEmpty(replacementList) || (ArrayUtils.isNotEmpty(searchList) && timeToLive == -1)) { if (isEmpty(text) || ArrayUtils.isEmpty(searchList) || ArrayUtils.isEmpty(replacementList) || ArrayUtils.isNotEmpty(searchList) && timeToLive == -1) {
return text; return text;
} }

View File

@ -993,7 +993,7 @@ public class MethodUtils {
final Class<?> acls; final Class<?> acls;
if (interfaceIndex >= allInterfaces.size()) { if (interfaceIndex >= allInterfaces.size()) {
acls = allSuperclasses.get(superClassIndex++); acls = allSuperclasses.get(superClassIndex++);
} else if ((superClassIndex >= allSuperclasses.size()) || !(superClassIndex < interfaceIndex)) { } else if (superClassIndex >= allSuperclasses.size() || !(superClassIndex < interfaceIndex)) {
acls = allInterfaces.get(interfaceIndex++); acls = allInterfaces.get(interfaceIndex++);
} else { } else {
acls = allSuperclasses.get(superClassIndex++); acls = allSuperclasses.get(superClassIndex++);

View File

@ -124,7 +124,7 @@ public class TypeUtils {
*/ */
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
return obj == this || obj instanceof ParameterizedType && TypeUtils.equals(this, ((ParameterizedType) obj)); return obj == this || obj instanceof ParameterizedType && TypeUtils.equals(this, (ParameterizedType) obj);
} }
/** /**
@ -566,8 +566,8 @@ public class TypeUtils {
parameterizedType.getActualTypeArguments().length); parameterizedType.getActualTypeArguments().length);
int[] indexesToRemove = {}; int[] indexesToRemove = {};
for (int i = 0; i < filteredArgumentTypes.length; i++) { for (int i = 0; i < filteredArgumentTypes.length; i++) {
if ((filteredArgumentTypes[i] instanceof TypeVariable<?>) && containsVariableTypeSameParametrizedTypeBound( if (filteredArgumentTypes[i] instanceof TypeVariable<?> && containsVariableTypeSameParametrizedTypeBound(
((TypeVariable<?>) filteredArgumentTypes[i]), parameterizedType)) { (TypeVariable<?>) filteredArgumentTypes[i], parameterizedType)) {
indexesToRemove = ArrayUtils.add(indexesToRemove, i); indexesToRemove = ArrayUtils.add(indexesToRemove, i);
} }
} }