Skip convert to Object from TypeConverterDelegate

Update TypeConverterDelegate to bypass conversion when the target type
is Object.class. Prior to this commit converting a single element array
to an Object would result in the element being returned, rather than
the array itself.

Issue: SPR-10996
This commit is contained in:
Phillip Webb
2013-10-18 17:19:41 -07:00
parent b25e91a550
commit c9aace4da2
2 changed files with 36 additions and 0 deletions

View File

@@ -187,6 +187,9 @@ class TypeConverterDelegate {
// Try to apply some standard type conversion rules if appropriate.
if (convertedValue != null) {
if (Object.class.equals(requiredType)) {
return (T) convertedValue;
}
if (requiredType.isArray()) {
// Array required -> apply appropriate conversion of elements.
if (convertedValue instanceof String && Enum.class.isAssignableFrom(requiredType.getComponentType())) {