diff --git a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java index 4c3475b6912..8b038d726a6 100644 --- a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java @@ -558,16 +558,8 @@ public abstract class ReflectionUtils { * Determine whether the given method is originally declared by {@link java.lang.Object}. */ public static boolean isObjectMethod(@Nullable Method method) { - if (method == null) { - return false; - } - try { - Object.class.getDeclaredMethod(method.getName(), method.getParameterTypes()); - return true; - } - catch (Exception ex) { - return false; - } + return (method != null && (method.getDeclaringClass() == Object.class || + isEqualsMethod(method) || isHashCodeMethod(method) || isToStringMethod(method))); } /**