diff --git a/spring-core/src/main/java/org/springframework/core/convert/converter/GenericConverter.java b/spring-core/src/main/java/org/springframework/core/convert/converter/GenericConverter.java index 11bc2945a7..09d3b10837 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/converter/GenericConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/converter/GenericConverter.java @@ -67,7 +67,7 @@ public interface GenericConverter { /** * Holder for a source-to-target class pair. */ - public static final class ConvertiblePair { + final class ConvertiblePair { private final Class sourceType; @@ -102,7 +102,7 @@ public interface GenericConverter { return false; } ConvertiblePair otherPair = (ConvertiblePair) other; - return (this.sourceType.equals(otherPair.sourceType) && this.targetType.equals(otherPair.targetType)); + return (this.sourceType == otherPair.sourceType && this.targetType == otherPair.targetType); } @Override diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java b/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java index 6ec4b309ab..52df6a7766 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java @@ -231,7 +231,7 @@ public class GenericConversionService implements ConfigurableConversionService { * @return the converted null object */ protected Object convertNullSource(TypeDescriptor sourceType, TypeDescriptor targetType) { - if (javaUtilOptionalEmpty != null && targetType.getObjectType().equals(javaUtilOptionalEmpty.getClass())) { + if (javaUtilOptionalEmpty != null && targetType.getObjectType() == javaUtilOptionalEmpty.getClass()) { return javaUtilOptionalEmpty; } return null; @@ -354,7 +354,7 @@ public class GenericConversionService implements ConfigurableConversionService { @Override public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { // Check raw type first... - if (!this.typeInfo.getTargetType().equals(targetType.getObjectType())) { + if (this.typeInfo.getTargetType() != targetType.getObjectType()) { return false; } // Full check for complex generic type match required?