Class identity comparisons wherever possible

Issue: SPR-12926
master
Juergen Hoeller 9 years ago
parent ea2843ecc0
commit 59b6600763
  1. 4
      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) { public static Method getMostSpecificMethod(Method method, Class<?> targetClass) {
if (method != null && isOverridable(method, targetClass) && if (method != null && isOverridable(method, targetClass) &&
targetClass != null && !targetClass.equals(method.getDeclaringClass())) { targetClass != null && targetClass != method.getDeclaringClass()) {
try { try {
if (Modifier.isPublic(method.getModifiers())) { if (Modifier.isPublic(method.getModifiers())) {
try { try {
@ -914,7 +914,7 @@ public abstract class ClassUtils {
} }
if (lhsType.isPrimitive()) { if (lhsType.isPrimitive()) {
Class<?> resolvedPrimitive = primitiveWrapperTypeMap.get(rhsType); Class<?> resolvedPrimitive = primitiveWrapperTypeMap.get(rhsType);
if (resolvedPrimitive != null && lhsType.equals(resolvedPrimitive)) { if (lhsType == resolvedPrimitive) {
return true; return true;
} }
} }

Loading…
Cancel
Save