Skip to content

Commit e90c7e2

Browse files
committed
Avoid a Map lookup when the type is not a primitive
1 parent d6e35cf commit e90c7e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-core/src/main/java/org/springframework/util/ClassUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,10 +614,11 @@ public static boolean isAssignable(Class<?> lhsType, Class<?> rhsType) {
614614
Class<?> resolvedPrimitive = primitiveWrapperTypeMap.get(rhsType);
615615
return (lhsType == resolvedPrimitive);
616616
}
617-
else {
617+
else if (rhsType.isPrimitive()) {
618618
Class<?> resolvedWrapper = primitiveTypeToWrapperMap.get(rhsType);
619619
return (resolvedWrapper != null && lhsType.isAssignableFrom(resolvedWrapper));
620620
}
621+
return false;
621622
}
622623

623624
/**

0 commit comments

Comments
 (0)