mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-28 18:19:05 +00:00
spr-7728: empty collection conversion can return value not assignable to targetType
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3883 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
-3
@@ -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());
|
||||
|
||||
-3
@@ -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