Polishing

(cherry picked from commit f19433f2d8)
This commit is contained in:
Juergen Hoeller
2023-07-11 18:01:07 +02:00
parent 16fd70ae35
commit ac94d2bd54
5 changed files with 18 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 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.
@@ -509,16 +509,8 @@ public abstract class ReflectionUtils {
* @see java.lang.Object#equals(Object)
*/
public static boolean isEqualsMethod(@Nullable Method method) {
if (method == null) {
return false;
}
if (method.getParameterCount() != 1) {
return false;
}
if (!method.getName().equals("equals")) {
return false;
}
return method.getParameterTypes()[0] == Object.class;
return (method != null && method.getParameterCount() == 1 && method.getName().equals("equals") &&
method.getParameterTypes()[0] == Object.class);
}
/**
@@ -526,7 +518,7 @@ public abstract class ReflectionUtils {
* @see java.lang.Object#hashCode()
*/
public static boolean isHashCodeMethod(@Nullable Method method) {
return method != null && method.getParameterCount() == 0 && method.getName().equals("hashCode");
return (method != null && method.getParameterCount() == 0 && method.getName().equals("hashCode"));
}
/**