DATACMNS-1598 - Polishing.

Add unit tests to back change. Guard invocations against null dereference.
Join assertions.

Original pull request: #409.
This commit is contained in:
Mark Paluch
2019-10-28 08:44:24 +01:00
parent 36b95d39ce
commit cace881a13
2 changed files with 31 additions and 11 deletions

View File

@@ -44,6 +44,7 @@ import org.springframework.util.ObjectUtils;
* projecting proxy in case the returned value is not of the return type of the invoked method.
*
* @author Oliver Gierke
* @author Mark Paluch
* @since 1.10
*/
@RequiredArgsConstructor
@@ -92,8 +93,9 @@ class ProjectingMethodInterceptor implements MethodInterceptor {
private Object projectCollectionElements(Collection<?> sources, TypeInformation<?> type) {
Class<?> rawType = type.getType();
TypeInformation<?> componentType = type.getComponentType();
Collection<Object> result = CollectionFactory.createCollection(rawType.isArray() ? List.class : rawType,
type.getComponentType().getType(), sources.size());
componentType != null ? componentType.getType() : null, sources.size());
for (Object source : sources) {
result.add(getProjection(source, type.getRequiredComponentType().getType()));