spr-7728: empty collection conversion can return value not assignable to targetType
This commit is contained in:
@@ -62,9 +62,6 @@ final class CollectionToCollectionConverter implements ConditionalGenericConvert
|
||||
return null;
|
||||
}
|
||||
Collection<?> sourceCollection = (Collection<?>) source;
|
||||
if (sourceCollection.isEmpty()) {
|
||||
return sourceCollection;
|
||||
}
|
||||
Collection target = CollectionFactory.createCollection(targetType.getType(), sourceCollection.size());
|
||||
for (Object sourceElement : sourceCollection) {
|
||||
Object targetElement = this.conversionService.convert(sourceElement, sourceType.getElementTypeDescriptor().applyIndexedObject(sourceElement), targetType.getElementTypeDescriptor());
|
||||
|
||||
@@ -67,9 +67,6 @@ final class MapToMapConverter implements ConditionalGenericConverter {
|
||||
return null;
|
||||
}
|
||||
Map<?, ?> sourceMap = (Map<?, ?>) source;
|
||||
if (sourceMap.isEmpty()) {
|
||||
return sourceMap;
|
||||
}
|
||||
Map targetMap = CollectionFactory.createMap(targetType.getType(), sourceMap.size());
|
||||
for (Object entry : sourceMap.entrySet()) {
|
||||
Map.Entry sourceMapEntry = (Map.Entry) entry;
|
||||
|
||||
Reference in New Issue
Block a user