use more modern java API for empty collections

This commit is contained in:
igor-suhorukov
2018-03-08 23:36:41 +03:00
committed by Juergen Hoeller
parent 32b689a994
commit 6163f2d32f

View File

@@ -91,13 +91,13 @@ public class ContextAnnotationAutowireCandidateResolver extends QualifierAnnotat
if (target == null) {
Class<?> type = getTargetClass();
if (Map.class == type) {
return Collections.EMPTY_MAP;
return Collections.emptyMap();
}
else if (List.class == type) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
else if (Set.class == type || Collection.class == type) {
return Collections.EMPTY_SET;
return Collections.emptySet();
}
throw new NoSuchBeanDefinitionException(descriptor.getResolvableType(),
"Optional dependency not present for lazy injection point");