Class identity comparisons wherever possible
Issue: SPR-12926
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user