From 59b66007638c6937daca6b0c5f97a0fbe8a111bf Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Sun, 8 Nov 2015 20:45:17 +0100 Subject: [PATCH] Class identity comparisons wherever possible Issue: SPR-12926 --- .../src/main/java/org/springframework/util/ClassUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/util/ClassUtils.java b/spring-core/src/main/java/org/springframework/util/ClassUtils.java index 2330177778..c4ee177cab 100644 --- a/spring-core/src/main/java/org/springframework/util/ClassUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ClassUtils.java @@ -762,7 +762,7 @@ public abstract class ClassUtils { */ public static Method getMostSpecificMethod(Method method, Class targetClass) { if (method != null && isOverridable(method, targetClass) && - targetClass != null && !targetClass.equals(method.getDeclaringClass())) { + targetClass != null && targetClass != method.getDeclaringClass()) { try { if (Modifier.isPublic(method.getModifiers())) { try { @@ -914,7 +914,7 @@ public abstract class ClassUtils { } if (lhsType.isPrimitive()) { Class resolvedPrimitive = primitiveWrapperTypeMap.get(rhsType); - if (resolvedPrimitive != null && lhsType.equals(resolvedPrimitive)) { + if (lhsType == resolvedPrimitive) { return true; } }