Skip to content

Commit 8f96712

Browse files
committed
Merge branch '5.1.x'
2 parents 13543f5 + 0cc6a9e commit 8f96712

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

spring-core/src/main/java/org/springframework/util/ReflectionUtils.java

+2-10
Original file line numberDiff line numberDiff line change
@@ -527,16 +527,8 @@ public static boolean isToStringMethod(@Nullable Method method) {
527527
* Determine whether the given method is originally declared by {@link java.lang.Object}.
528528
*/
529529
public static boolean isObjectMethod(@Nullable Method method) {
530-
if (method == null) {
531-
return false;
532-
}
533-
try {
534-
Object.class.getDeclaredMethod(method.getName(), method.getParameterTypes());
535-
return true;
536-
}
537-
catch (Exception ex) {
538-
return false;
539-
}
530+
return (method != null && (method.getDeclaringClass() == Object.class ||
531+
isEqualsMethod(method) || isHashCodeMethod(method) || isToStringMethod(method)));
540532
}
541533

542534
/**

0 commit comments

Comments
 (0)