Explicit type can be replaced by <>

Issue: SPR-13188
This commit is contained in:
Stephane Nicoll
2016-07-05 17:00:26 +02:00
parent 3096888c7d
commit 00d2606b00
1044 changed files with 3972 additions and 3893 deletions

View File

@@ -808,7 +808,7 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
*/
private AbstractNestablePropertyAccessor getNestedPropertyAccessor(String nestedProperty) {
if (this.nestedPropertyAccessors == null) {
this.nestedPropertyAccessors = new HashMap<String, AbstractNestablePropertyAccessor>();
this.nestedPropertyAccessors = new HashMap<>();
}
// Get value of bean property.
PropertyTokenHolder tokens = getPropertyNameTokens(nestedProperty);
@@ -909,7 +909,7 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
private PropertyTokenHolder getPropertyNameTokens(String propertyName) {
PropertyTokenHolder tokens = new PropertyTokenHolder();
String actualName = null;
List<String> keys = new ArrayList<String>(2);
List<String> keys = new ArrayList<>(2);
int searchIndex = 0;
while (searchIndex != -1) {
int keyStart = propertyName.indexOf(PROPERTY_KEY_PREFIX, searchIndex);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -108,7 +108,7 @@ public abstract class AbstractPropertyAccessor extends TypeConverterSupport impl
}
catch (PropertyAccessException ex) {
if (propertyAccessExceptions == null) {
propertyAccessExceptions = new LinkedList<PropertyAccessException>();
propertyAccessExceptions = new LinkedList<>();
}
propertyAccessExceptions.add(ex);
}

View File

@@ -114,14 +114,14 @@ public class CachedIntrospectionResults {
* This variant is being used for cache-safe bean classes.
*/
static final ConcurrentMap<Class<?>, CachedIntrospectionResults> strongClassCache =
new ConcurrentHashMap<Class<?>, CachedIntrospectionResults>(64);
new ConcurrentHashMap<>(64);
/**
* Map keyed by Class containing CachedIntrospectionResults, softly held.
* This variant is being used for non-cache-safe bean classes.
*/
static final ConcurrentMap<Class<?>, CachedIntrospectionResults> softClassCache =
new ConcurrentReferenceHashMap<Class<?>, CachedIntrospectionResults>(64);
new ConcurrentReferenceHashMap<>(64);
/**
@@ -283,7 +283,7 @@ public class CachedIntrospectionResults {
if (logger.isTraceEnabled()) {
logger.trace("Caching PropertyDescriptors for class [" + beanClass.getName() + "]");
}
this.propertyDescriptorCache = new LinkedHashMap<String, PropertyDescriptor>();
this.propertyDescriptorCache = new LinkedHashMap<>();
// This call is slow so we do it once.
PropertyDescriptor[] pds = this.beanInfo.getPropertyDescriptors();
@@ -321,7 +321,7 @@ public class CachedIntrospectionResults {
clazz = clazz.getSuperclass();
}
this.typeDescriptorCache = new ConcurrentReferenceHashMap<PropertyDescriptor, TypeDescriptor>();
this.typeDescriptorCache = new ConcurrentReferenceHashMap<>();
}
catch (IntrospectionException ex) {
throw new FatalBeanException("Failed to obtain BeanInfo for class [" + beanClass.getName() + "]", ex);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ import org.springframework.util.ReflectionUtils;
*/
public class DirectFieldAccessor extends AbstractNestablePropertyAccessor {
private final Map<String, FieldPropertyHandler> fieldMap = new HashMap<String, FieldPropertyHandler>();
private final Map<String, FieldPropertyHandler> fieldMap = new HashMap<>();
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -80,7 +80,7 @@ class ExtendedBeanInfo implements BeanInfo {
private final BeanInfo delegate;
private final Set<PropertyDescriptor> propertyDescriptors =
new TreeSet<PropertyDescriptor>(new PropertyDescriptorComparator());
new TreeSet<>(new PropertyDescriptorComparator());
/**
@@ -128,7 +128,7 @@ class ExtendedBeanInfo implements BeanInfo {
private List<Method> findCandidateWriteMethods(MethodDescriptor[] methodDescriptors) {
List<Method> matches = new ArrayList<Method>();
List<Method> matches = new ArrayList<>();
for (MethodDescriptor methodDescriptor : methodDescriptors) {
Method method = methodDescriptor.getMethod();
if (isCandidateWriteMethod(method)) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -87,7 +87,7 @@ final class GenericTypeAwarePropertyDescriptor extends PropertyDescriptor {
// Write method not matched against read method: potentially ambiguous through
// several overloaded variants, in which case an arbitrary winner has been chosen
// by the JDK's JavaBeans Introspector...
Set<Method> ambiguousCandidates = new HashSet<Method>();
Set<Method> ambiguousCandidates = new HashSet<>();
for (Method method : beanClass.getMethods()) {
if (method.getName().equals(writeMethodToUse.getName()) &&
!method.equals(writeMethodToUse) && !method.isBridge() &&

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
* @see #add(String, Object)
*/
public MutablePropertyValues() {
this.propertyValueList = new ArrayList<PropertyValue>(0);
this.propertyValueList = new ArrayList<>(0);
}
/**
@@ -66,13 +66,13 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
// There is no replacement of existing property values.
if (original != null) {
PropertyValue[] pvs = original.getPropertyValues();
this.propertyValueList = new ArrayList<PropertyValue>(pvs.length);
this.propertyValueList = new ArrayList<>(pvs.length);
for (PropertyValue pv : pvs) {
this.propertyValueList.add(new PropertyValue(pv));
}
}
else {
this.propertyValueList = new ArrayList<PropertyValue>(0);
this.propertyValueList = new ArrayList<>(0);
}
}
@@ -85,13 +85,13 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
// We can optimize this because it's all new:
// There is no replacement of existing property values.
if (original != null) {
this.propertyValueList = new ArrayList<PropertyValue>(original.size());
this.propertyValueList = new ArrayList<>(original.size());
for (Map.Entry<?, ?> entry : original.entrySet()) {
this.propertyValueList.add(new PropertyValue(entry.getKey().toString(), entry.getValue()));
}
}
else {
this.propertyValueList = new ArrayList<PropertyValue>(0);
this.propertyValueList = new ArrayList<>(0);
}
}
@@ -104,7 +104,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
*/
public MutablePropertyValues(List<PropertyValue> propertyValueList) {
this.propertyValueList =
(propertyValueList != null ? propertyValueList : new ArrayList<PropertyValue>());
(propertyValueList != null ? propertyValueList : new ArrayList<>());
}
@@ -316,7 +316,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
*/
public void registerProcessedProperty(String propertyName) {
if (this.processedProperties == null) {
this.processedProperties = new HashSet<String>();
this.processedProperties = new HashSet<>();
}
this.processedProperties.add(propertyName);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -167,7 +167,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
*/
public void overrideDefaultEditor(Class<?> requiredType, PropertyEditor propertyEditor) {
if (this.overriddenDefaultEditors == null) {
this.overriddenDefaultEditors = new HashMap<Class<?>, PropertyEditor>();
this.overriddenDefaultEditors = new HashMap<>();
}
this.overriddenDefaultEditors.put(requiredType, propertyEditor);
}
@@ -199,7 +199,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
* Actually register the default editors for this registry instance.
*/
private void createDefaultEditors() {
this.defaultEditors = new HashMap<Class<?>, PropertyEditor>(64);
this.defaultEditors = new HashMap<>(64);
// Simple editors, without parameterization capabilities.
// The JDK does not contain a default editor for any of these target types.
@@ -298,13 +298,13 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
}
if (propertyPath != null) {
if (this.customEditorsForPath == null) {
this.customEditorsForPath = new LinkedHashMap<String, CustomEditorHolder>(16);
this.customEditorsForPath = new LinkedHashMap<>(16);
}
this.customEditorsForPath.put(propertyPath, new CustomEditorHolder(propertyEditor, requiredType));
}
else {
if (this.customEditors == null) {
this.customEditors = new LinkedHashMap<Class<?>, PropertyEditor>(16);
this.customEditors = new LinkedHashMap<>(16);
}
this.customEditors.put(requiredType, propertyEditor);
this.customEditorCache = null;
@@ -319,7 +319,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
// Check property-specific editor first.
PropertyEditor editor = getCustomEditor(propertyPath, requiredType);
if (editor == null) {
List<String> strippedPaths = new LinkedList<String>();
List<String> strippedPaths = new LinkedList<>();
addStrippedPropertyPaths(strippedPaths, "", propertyPath);
for (Iterator<String> it = strippedPaths.iterator(); it.hasNext() && editor == null;) {
String strippedPath = it.next();
@@ -415,7 +415,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
// Cache editor for search type, to avoid the overhead
// of repeated assignable-from checks.
if (this.customEditorCache == null) {
this.customEditorCache = new HashMap<Class<?>, PropertyEditor>();
this.customEditorCache = new HashMap<>();
}
this.customEditorCache.put(requiredType, editor);
}
@@ -435,7 +435,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
if (this.customEditorsForPath != null) {
CustomEditorHolder editorHolder = this.customEditorsForPath.get(propertyName);
if (editorHolder == null) {
List<String> strippedPaths = new LinkedList<String>();
List<String> strippedPaths = new LinkedList<>();
addStrippedPropertyPaths(strippedPaths, "", propertyName);
for (Iterator<String> it = strippedPaths.iterator(); it.hasNext() && editorHolder == null;) {
String strippedName = it.next();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -200,7 +200,7 @@ public abstract class PropertyMatches {
* @param maxDistance the maximum distance to accept
*/
private static String[] calculateMatches(String propertyName, PropertyDescriptor[] propertyDescriptors, int maxDistance) {
List<String> candidates = new ArrayList<String>();
List<String> candidates = new ArrayList<>();
for (PropertyDescriptor pd : propertyDescriptors) {
if (pd.getWriteMethod() != null) {
String possibleAlternative = pd.getName();
@@ -241,7 +241,7 @@ public abstract class PropertyMatches {
}
private static String[] calculateMatches(final String propertyName, Class<?> beanClass, final int maxDistance) {
final List<String> candidates = new ArrayList<String>();
final List<String> candidates = new ArrayList<>();
ReflectionUtils.doWithFields(beanClass, new ReflectionUtils.FieldCallback() {
@Override
public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,7 +59,7 @@ public abstract class AnnotationBeanUtils {
* @see org.springframework.beans.BeanWrapper
*/
public static void copyPropertiesToBean(Annotation ann, Object bean, StringValueResolver valueResolver, String... excludedProperties) {
Set<String> excluded = new HashSet<String>(Arrays.asList(excludedProperties));
Set<String> excluded = new HashSet<>(Arrays.asList(excludedProperties));
Method[] annotationProperties = ann.annotationType().getDeclaredMethods();
BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(bean);
for (Method annotationProperty : annotationProperties) {

View File

@@ -129,7 +129,7 @@ public class BeanCreationException extends FatalBeanException {
*/
public void addRelatedCause(Throwable ex) {
if (this.relatedCauses == null) {
this.relatedCauses = new LinkedList<Throwable>();
this.relatedCauses = new LinkedList<>();
}
this.relatedCauses.add(ex);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -147,7 +147,7 @@ public abstract class BeanFactoryUtils {
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
String[] parentResult = beanNamesForTypeIncludingAncestors(
(ListableBeanFactory) hbf.getParentBeanFactory(), type);
List<String> resultList = new ArrayList<String>();
List<String> resultList = new ArrayList<>();
resultList.addAll(Arrays.asList(result));
for (String beanName : parentResult) {
if (!resultList.contains(beanName) && !hbf.containsLocalBean(beanName)) {
@@ -180,7 +180,7 @@ public abstract class BeanFactoryUtils {
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
String[] parentResult = beanNamesForTypeIncludingAncestors(
(ListableBeanFactory) hbf.getParentBeanFactory(), type);
List<String> resultList = new ArrayList<String>();
List<String> resultList = new ArrayList<>();
resultList.addAll(Arrays.asList(result));
for (String beanName : parentResult) {
if (!resultList.contains(beanName) && !hbf.containsLocalBean(beanName)) {
@@ -223,7 +223,7 @@ public abstract class BeanFactoryUtils {
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
String[] parentResult = beanNamesForTypeIncludingAncestors(
(ListableBeanFactory) hbf.getParentBeanFactory(), type, includeNonSingletons, allowEagerInit);
List<String> resultList = new ArrayList<String>();
List<String> resultList = new ArrayList<>();
resultList.addAll(Arrays.asList(result));
for (String beanName : parentResult) {
if (!resultList.contains(beanName) && !hbf.containsLocalBean(beanName)) {
@@ -257,7 +257,7 @@ public abstract class BeanFactoryUtils {
throws BeansException {
Assert.notNull(lbf, "ListableBeanFactory must not be null");
Map<String, T> result = new LinkedHashMap<String, T>(4);
Map<String, T> result = new LinkedHashMap<>(4);
result.putAll(lbf.getBeansOfType(type));
if (lbf instanceof HierarchicalBeanFactory) {
HierarchicalBeanFactory hbf = (HierarchicalBeanFactory) lbf;
@@ -306,7 +306,7 @@ public abstract class BeanFactoryUtils {
throws BeansException {
Assert.notNull(lbf, "ListableBeanFactory must not be null");
Map<String, T> result = new LinkedHashMap<String, T>(4);
Map<String, T> result = new LinkedHashMap<>(4);
result.putAll(lbf.getBeansOfType(type, includeNonSingletons, allowEagerInit));
if (lbf instanceof HierarchicalBeanFactory) {
HierarchicalBeanFactory hbf = (HierarchicalBeanFactory) lbf;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -275,7 +275,7 @@ public class SingletonBeanFactoryLocator implements BeanFactoryLocator {
protected static final Log logger = LogFactory.getLog(SingletonBeanFactoryLocator.class);
/** The keyed BeanFactory instances */
private static final Map<String, BeanFactoryLocator> instances = new HashMap<String, BeanFactoryLocator>();
private static final Map<String, BeanFactoryLocator> instances = new HashMap<>();
/**
@@ -333,9 +333,9 @@ public class SingletonBeanFactoryLocator implements BeanFactoryLocator {
// We map BeanFactoryGroup objects by String keys, and by the definition object.
private final Map<String, BeanFactoryGroup> bfgInstancesByKey = new HashMap<String, BeanFactoryGroup>();
private final Map<String, BeanFactoryGroup> bfgInstancesByKey = new HashMap<>();
private final Map<BeanFactory, BeanFactoryGroup> bfgInstancesByObj = new HashMap<BeanFactory, BeanFactoryGroup>();
private final Map<BeanFactory, BeanFactoryGroup> bfgInstancesByObj = new HashMap<>();
private final String resourceLocation;

View File

@@ -120,7 +120,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
protected final Log logger = LogFactory.getLog(getClass());
private final Set<Class<? extends Annotation>> autowiredAnnotationTypes =
new LinkedHashSet<Class<? extends Annotation>>();
new LinkedHashSet<>();
private String requiredParameterName = "required";
@@ -134,10 +134,10 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(256));
private final Map<Class<?>, Constructor<?>[]> candidateConstructorsCache =
new ConcurrentHashMap<Class<?>, Constructor<?>[]>(256);
new ConcurrentHashMap<>(256);
private final Map<String, InjectionMetadata> injectionMetadataCache =
new ConcurrentHashMap<String, InjectionMetadata>(256);
new ConcurrentHashMap<>(256);
/**
@@ -267,7 +267,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
candidateConstructors = this.candidateConstructorsCache.get(beanClass);
if (candidateConstructors == null) {
Constructor<?>[] rawCandidates = beanClass.getDeclaredConstructors();
List<Constructor<?>> candidates = new ArrayList<Constructor<?>>(rawCandidates.length);
List<Constructor<?>> candidates = new ArrayList<>(rawCandidates.length);
Constructor<?> requiredConstructor = null;
Constructor<?> defaultConstructor = null;
for (Constructor<?> candidate : rawCandidates) {
@@ -405,12 +405,12 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
}
private InjectionMetadata buildAutowiringMetadata(final Class<?> clazz) {
LinkedList<InjectionMetadata.InjectedElement> elements = new LinkedList<InjectionMetadata.InjectedElement>();
LinkedList<InjectionMetadata.InjectedElement> elements = new LinkedList<>();
Class<?> targetClass = clazz;
do {
final LinkedList<InjectionMetadata.InjectedElement> currElements =
new LinkedList<InjectionMetadata.InjectedElement>();
new LinkedList<>();
ReflectionUtils.doWithLocalFields(targetClass, new ReflectionUtils.FieldCallback() {
@Override
@@ -560,7 +560,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
else {
DependencyDescriptor desc = new DependencyDescriptor(field, this.required);
desc.setContainingClass(bean.getClass());
Set<String> autowiredBeanNames = new LinkedHashSet<String>(1);
Set<String> autowiredBeanNames = new LinkedHashSet<>(1);
TypeConverter typeConverter = beanFactory.getTypeConverter();
try {
value = beanFactory.resolveDependency(desc, beanName, autowiredBeanNames, typeConverter);
@@ -628,7 +628,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
Class<?>[] paramTypes = method.getParameterTypes();
arguments = new Object[paramTypes.length];
DependencyDescriptor[] descriptors = new DependencyDescriptor[paramTypes.length];
Set<String> autowiredBeanNames = new LinkedHashSet<String>(paramTypes.length);
Set<String> autowiredBeanNames = new LinkedHashSet<>(paramTypes.length);
TypeConverter typeConverter = beanFactory.getTypeConverter();
for (int i = 0; i < arguments.length; i++) {
MethodParameter methodParam = new MethodParameter(method, i);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,7 +83,7 @@ public class InitDestroyAnnotationBeanPostProcessor
private int order = Ordered.LOWEST_PRECEDENCE;
private transient final Map<Class<?>, LifecycleMetadata> lifecycleMetadataCache =
new ConcurrentHashMap<Class<?>, LifecycleMetadata>(256);
new ConcurrentHashMap<>(256);
/**
@@ -194,13 +194,13 @@ public class InitDestroyAnnotationBeanPostProcessor
private LifecycleMetadata buildLifecycleMetadata(final Class<?> clazz) {
final boolean debug = logger.isDebugEnabled();
LinkedList<LifecycleElement> initMethods = new LinkedList<LifecycleElement>();
LinkedList<LifecycleElement> destroyMethods = new LinkedList<LifecycleElement>();
LinkedList<LifecycleElement> initMethods = new LinkedList<>();
LinkedList<LifecycleElement> destroyMethods = new LinkedList<>();
Class<?> targetClass = clazz;
do {
final LinkedList<LifecycleElement> currInitMethods = new LinkedList<LifecycleElement>();
final LinkedList<LifecycleElement> currDestroyMethods = new LinkedList<LifecycleElement>();
final LinkedList<LifecycleElement> currInitMethods = new LinkedList<>();
final LinkedList<LifecycleElement> currDestroyMethods = new LinkedList<>();
ReflectionUtils.doWithLocalMethods(targetClass, new ReflectionUtils.MethodCallback() {
@Override
@@ -272,7 +272,7 @@ public class InitDestroyAnnotationBeanPostProcessor
}
public void checkConfigMembers(RootBeanDefinition beanDefinition) {
Set<LifecycleElement> checkedInitMethods = new LinkedHashSet<LifecycleElement>(this.initMethods.size());
Set<LifecycleElement> checkedInitMethods = new LinkedHashSet<>(this.initMethods.size());
for (LifecycleElement element : this.initMethods) {
String methodIdentifier = element.getIdentifier();
if (!beanDefinition.isExternallyManagedInitMethod(methodIdentifier)) {
@@ -283,7 +283,7 @@ public class InitDestroyAnnotationBeanPostProcessor
}
}
}
Set<LifecycleElement> checkedDestroyMethods = new LinkedHashSet<LifecycleElement>(this.destroyMethods.size());
Set<LifecycleElement> checkedDestroyMethods = new LinkedHashSet<>(this.destroyMethods.size());
for (LifecycleElement element : this.destroyMethods) {
String methodIdentifier = element.getIdentifier();
if (!beanDefinition.isExternallyManagedDestroyMethod(methodIdentifier)) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,7 +62,7 @@ public class InjectionMetadata {
public void checkConfigMembers(RootBeanDefinition beanDefinition) {
Set<InjectedElement> checkedElements = new LinkedHashSet<InjectedElement>(this.injectedElements.size());
Set<InjectedElement> checkedElements = new LinkedHashSet<>(this.injectedElements.size());
for (InjectedElement element : this.injectedElements) {
Member member = element.getMember();
if (!beanDefinition.isExternallyManagedConfigMember(member)) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ import org.springframework.util.StringUtils;
*/
public class QualifierAnnotationAutowireCandidateResolver extends GenericTypeAwareAutowireCandidateResolver {
private final Set<Class<? extends Annotation>> qualifierTypes = new LinkedHashSet<Class<? extends Annotation>>(2);
private final Set<Class<? extends Annotation>> qualifierTypes = new LinkedHashSet<>(2);
private Class<? extends Annotation> valueAnnotationType = Value.class;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -146,7 +146,7 @@ public class RequiredAnnotationBeanPostProcessor extends InstantiationAwareBeanP
if (!this.validatedBeanNames.contains(beanName)) {
if (!shouldSkip(this.beanFactory, beanName)) {
List<String> invalidProperties = new ArrayList<String>();
List<String> invalidProperties = new ArrayList<>();
for (PropertyDescriptor pd : pds) {
if (isRequiredProperty(pd) && !pvs.contains(pd.getName())) {
invalidProperties.add(pd.getName());

View File

@@ -42,9 +42,9 @@ import org.springframework.util.ObjectUtils;
*/
public class ConstructorArgumentValues {
private final Map<Integer, ValueHolder> indexedArgumentValues = new LinkedHashMap<Integer, ValueHolder>(0);
private final Map<Integer, ValueHolder> indexedArgumentValues = new LinkedHashMap<>(0);
private final List<ValueHolder> genericArgumentValues = new LinkedList<ValueHolder>();
private final List<ValueHolder> genericArgumentValues = new LinkedList<>();
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,7 +70,7 @@ public class CustomScopeConfigurer implements BeanFactoryPostProcessor, BeanClas
*/
public void addScope(String scopeName, Scope scope) {
if (this.scopes == null) {
this.scopes = new LinkedHashMap<String, Object>(1);
this.scopes = new LinkedHashMap<>(1);
}
this.scopes.put(scopeName, scope);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -82,7 +82,7 @@ public class ListFactoryBean extends AbstractFactoryBean<List<Object>> {
result = BeanUtils.instantiateClass(this.targetListClass);
}
else {
result = new ArrayList<Object>(this.sourceList.size());
result = new ArrayList<>(this.sourceList.size());
}
Class<?> valueType = null;
if (this.targetListClass != null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -82,7 +82,7 @@ public class MapFactoryBean extends AbstractFactoryBean<Map<Object, Object>> {
result = BeanUtils.instantiateClass(this.targetMapClass);
}
else {
result = new LinkedHashMap<Object, Object>(this.sourceMap.size());
result = new LinkedHashMap<>(this.sourceMap.size());
}
Class<?> keyType = null;
Class<?> valueType = null;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -82,7 +82,7 @@ public class SetFactoryBean extends AbstractFactoryBean<Set<Object>> {
result = BeanUtils.instantiateClass(this.targetSetClass);
}
else {
result = new LinkedHashSet<Object>(this.sourceSet.size());
result = new LinkedHashSet<>(this.sourceSet.size());
}
Class<?> valueType = null;
if (this.targetSetClass != null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -112,7 +112,7 @@ public class YamlMapFactoryBean extends YamlProcessor implements FactoryBean<Map
* @see #process(java.util.Map, MatchCallback)
*/
protected Map<String, Object> createMap() {
final Map<String, Object> result = new LinkedHashMap<String, Object>();
final Map<String, Object> result = new LinkedHashMap<>();
process(new MatchCallback() {
@Override
public void process(Properties properties, Map<String, Object> map) {
@@ -129,7 +129,7 @@ public class YamlMapFactoryBean extends YamlProcessor implements FactoryBean<Map
Object value = entry.getValue();
Object existing = output.get(key);
if (value instanceof Map && existing instanceof Map) {
Map<String, Object> result = new LinkedHashMap<String, Object>((Map) existing);
Map<String, Object> result = new LinkedHashMap<>((Map) existing);
merge(result, (Map) value);
output.put(key, result);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -191,7 +191,7 @@ public abstract class YamlProcessor {
@SuppressWarnings("unchecked")
private Map<String, Object> asMap(Object object) {
// YAML can have numbers as keys
Map<String, Object> result = new LinkedHashMap<String, Object>();
Map<String, Object> result = new LinkedHashMap<>();
if (!(object instanceof Map)) {
// A document can be a text literal
result.put("document", object);
@@ -265,7 +265,7 @@ public abstract class YamlProcessor {
* @since 4.1.3
*/
protected final Map<String, Object> getFlattenedMap(Map<String, Object> source) {
Map<String, Object> result = new LinkedHashMap<String, Object>();
Map<String, Object> result = new LinkedHashMap<>();
buildFlattenedMap(result, source, null);
return result;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,8 +73,8 @@ public class BeanComponentDefinition extends BeanDefinitionHolder implements Com
private void findInnerBeanDefinitionsAndBeanReferences(BeanDefinition beanDefinition) {
List<BeanDefinition> innerBeans = new ArrayList<BeanDefinition>();
List<BeanReference> references = new ArrayList<BeanReference>();
List<BeanDefinition> innerBeans = new ArrayList<>();
List<BeanReference> references = new ArrayList<>();
PropertyValues propertyValues = beanDefinition.getPropertyValues();
for (int i = 0; i < propertyValues.getPropertyValues().length; i++) {
PropertyValue propertyValue = propertyValues.getPropertyValues()[i];

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ public class CompositeComponentDefinition extends AbstractComponentDefinition {
private final Object source;
private final List<ComponentDefinition> nestedComponents = new LinkedList<ComponentDefinition>();
private final List<ComponentDefinition> nestedComponents = new LinkedList<>();
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ public final class ParseState {
* Create a new {@code ParseState} with an empty {@link Stack}.
*/
public ParseState() {
this.state = new Stack<Entry>();
this.state = new Stack<>();
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ public class ServiceListFactoryBean extends AbstractServiceLoaderBasedFactoryBea
@Override
protected Object getObjectToExpose(ServiceLoader<?> serviceLoader) {
List<Object> result = new LinkedList<Object>();
List<Object> result = new LinkedList<>();
for (Object loaderObject : serviceLoader) {
result.add(loaderObject);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -136,21 +136,21 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
* Dependency types to ignore on dependency check and autowire, as Set of
* Class objects: for example, String. Default is none.
*/
private final Set<Class<?>> ignoredDependencyTypes = new HashSet<Class<?>>();
private final Set<Class<?>> ignoredDependencyTypes = new HashSet<>();
/**
* Dependency interfaces to ignore on dependency check and autowire, as Set of
* Class objects. By default, only the BeanFactory interface is ignored.
*/
private final Set<Class<?>> ignoredDependencyInterfaces = new HashSet<Class<?>>();
private final Set<Class<?>> ignoredDependencyInterfaces = new HashSet<>();
/** Cache of unfinished FactoryBean instances: FactoryBean name --> BeanWrapper */
private final Map<String, BeanWrapper> factoryBeanInstanceCache =
new ConcurrentHashMap<String, BeanWrapper>(16);
new ConcurrentHashMap<>(16);
/** Cache of filtered PropertyDescriptors: bean Class -> PropertyDescriptor array */
private final ConcurrentMap<Class<?>, PropertyDescriptor[]> filteredPropertyDescriptorsCache =
new ConcurrentHashMap<Class<?>, PropertyDescriptor[]>(256);
new ConcurrentHashMap<>(256);
/**
@@ -562,7 +562,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
}
else if (!this.allowRawInjectionDespiteWrapping && hasDependentBean(beanName)) {
String[] dependentBeans = getDependentBeans(beanName);
Set<String> actualDependentBeans = new LinkedHashSet<String>(dependentBeans.length);
Set<String> actualDependentBeans = new LinkedHashSet<>(dependentBeans.length);
for (String dependentBean : dependentBeans) {
if (!removeSingletonIfCreatedForTypeCheckOnly(dependentBean)) {
actualDependentBeans.add(dependentBean);
@@ -697,7 +697,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
}
ConstructorArgumentValues cav = mbd.getConstructorArgumentValues();
Set<ConstructorArgumentValues.ValueHolder> usedValueHolders =
new HashSet<ConstructorArgumentValues.ValueHolder>(paramTypes.length);
new HashSet<>(paramTypes.length);
Object[] args = new Object[paramTypes.length];
for (int i = 0; i < args.length; i++) {
ConstructorArgumentValues.ValueHolder valueHolder = cav.getArgumentValue(
@@ -1277,7 +1277,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
converter = bw;
}
Set<String> autowiredBeanNames = new LinkedHashSet<String>(4);
Set<String> autowiredBeanNames = new LinkedHashSet<>(4);
String[] propertyNames = unsatisfiedNonSimpleProperties(mbd, bw);
for (String propertyName : propertyNames) {
try {
@@ -1320,7 +1320,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
* @see org.springframework.beans.BeanUtils#isSimpleProperty
*/
protected String[] unsatisfiedNonSimpleProperties(AbstractBeanDefinition mbd, BeanWrapper bw) {
Set<String> result = new TreeSet<String>();
Set<String> result = new TreeSet<>();
PropertyValues pvs = mbd.getPropertyValues();
PropertyDescriptor[] pds = bw.getPropertyDescriptors();
for (PropertyDescriptor pd : pds) {
@@ -1365,7 +1365,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
*/
protected PropertyDescriptor[] filterPropertyDescriptorsForDependencyCheck(BeanWrapper bw) {
List<PropertyDescriptor> pds =
new LinkedList<PropertyDescriptor>(Arrays.asList(bw.getPropertyDescriptors()));
new LinkedList<>(Arrays.asList(bw.getPropertyDescriptors()));
for (Iterator<PropertyDescriptor> it = pds.iterator(); it.hasNext();) {
PropertyDescriptor pd = it.next();
if (isExcludedFromDependencyCheck(pd)) {
@@ -1469,7 +1469,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
BeanDefinitionValueResolver valueResolver = new BeanDefinitionValueResolver(this, beanName, mbd, converter);
// Create a deep copy, resolving any references for values.
List<PropertyValue> deepCopy = new ArrayList<PropertyValue>(original.size());
List<PropertyValue> deepCopy = new ArrayList<>(original.size());
boolean resolveNecessary = false;
for (PropertyValue pv : original) {
if (pv.isConverted()) {

View File

@@ -153,7 +153,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
private boolean primary = false;
private final Map<String, AutowireCandidateQualifier> qualifiers =
new LinkedHashMap<String, AutowireCandidateQualifier>(0);
new LinkedHashMap<>(0);
private boolean nonPublicAccessAllowed = true;
@@ -631,7 +631,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
* @return the Set of {@link AutowireCandidateQualifier} objects.
*/
public Set<AutowireCandidateQualifier> getQualifiers() {
return new LinkedHashSet<AutowireCandidateQualifier>(this.qualifiers.values());
return new LinkedHashSet<>(this.qualifiers.values());
}
/**

View File

@@ -132,20 +132,20 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
/** Custom PropertyEditorRegistrars to apply to the beans of this factory */
private final Set<PropertyEditorRegistrar> propertyEditorRegistrars =
new LinkedHashSet<PropertyEditorRegistrar>(4);
new LinkedHashSet<>(4);
/** A custom TypeConverter to use, overriding the default PropertyEditor mechanism */
private TypeConverter typeConverter;
/** Custom PropertyEditors to apply to the beans of this factory */
private final Map<Class<?>, Class<? extends PropertyEditor>> customEditors =
new HashMap<Class<?>, Class<? extends PropertyEditor>>(4);
new HashMap<>(4);
/** String resolvers to apply e.g. to annotation attribute values */
private final List<StringValueResolver> embeddedValueResolvers = new LinkedList<StringValueResolver>();
private final List<StringValueResolver> embeddedValueResolvers = new LinkedList<>();
/** BeanPostProcessors to apply in createBean */
private final List<BeanPostProcessor> beanPostProcessors = new ArrayList<BeanPostProcessor>();
private final List<BeanPostProcessor> beanPostProcessors = new ArrayList<>();
/** Indicates whether any InstantiationAwareBeanPostProcessors have been registered */
private boolean hasInstantiationAwareBeanPostProcessors;
@@ -154,14 +154,14 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
private boolean hasDestructionAwareBeanPostProcessors;
/** Map from scope identifier String to corresponding Scope */
private final Map<String, Scope> scopes = new LinkedHashMap<String, Scope>(8);
private final Map<String, Scope> scopes = new LinkedHashMap<>(8);
/** Security context used when running with a SecurityManager */
private SecurityContextProvider securityContextProvider;
/** Map from bean name to merged RootBeanDefinition */
private final Map<String, RootBeanDefinition> mergedBeanDefinitions =
new ConcurrentHashMap<String, RootBeanDefinition>(256);
new ConcurrentHashMap<>(256);
/** Names of beans that have already been created at least once */
private final Set<String> alreadyCreated =
@@ -169,7 +169,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
/** Names of beans that are currently in creation */
private final ThreadLocal<Object> prototypesCurrentlyInCreation =
new NamedThreadLocal<Object>("Prototype beans currently in creation");
new NamedThreadLocal<>("Prototype beans currently in creation");
/**
@@ -627,7 +627,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
@Override
public String[] getAliases(String name) {
String beanName = transformedBeanName(name);
List<String> aliases = new ArrayList<String>();
List<String> aliases = new ArrayList<>();
boolean factoryPrefix = name.startsWith(FACTORY_BEAN_PREFIX);
String fullBeanName = beanName;
if (factoryPrefix) {
@@ -1009,7 +1009,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
this.prototypesCurrentlyInCreation.set(beanName);
}
else if (curVal instanceof String) {
Set<String> beanNameSet = new HashSet<String>(2);
Set<String> beanNameSet = new HashSet<>(2);
beanNameSet.add((String) curVal);
beanNameSet.add(beanName);
this.prototypesCurrentlyInCreation.set(beanNameSet);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -376,7 +376,7 @@ class BeanDefinitionValueResolver {
* For each element in the managed list, resolve reference if necessary.
*/
private List<?> resolveManagedList(Object argName, List<?> ml) {
List<Object> resolved = new ArrayList<Object>(ml.size());
List<Object> resolved = new ArrayList<>(ml.size());
for (int i = 0; i < ml.size(); i++) {
resolved.add(
resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i)));
@@ -388,7 +388,7 @@ class BeanDefinitionValueResolver {
* For each element in the managed set, resolve reference if necessary.
*/
private Set<?> resolveManagedSet(Object argName, Set<?> ms) {
Set<Object> resolved = new LinkedHashSet<Object>(ms.size());
Set<Object> resolved = new LinkedHashSet<>(ms.size());
int i = 0;
for (Object m : ms) {
resolved.add(resolveValueIfNecessary(new KeyedArgName(argName, i), m));
@@ -401,7 +401,7 @@ class BeanDefinitionValueResolver {
* For each element in the managed map, resolve reference if necessary.
*/
private Map<?, ?> resolveManagedMap(Object argName, Map<?, ?> mm) {
Map<Object, Object> resolved = new LinkedHashMap<Object, Object>(mm.size());
Map<Object, Object> resolved = new LinkedHashMap<>(mm.size());
for (Map.Entry<?, ?> entry : mm.entrySet()) {
Object resolvedKey = resolveValueIfNecessary(argName, entry.getKey());
Object resolvedValue = resolveValueIfNecessary(

View File

@@ -71,7 +71,7 @@ import org.springframework.util.StringUtils;
class ConstructorResolver {
private static final NamedThreadLocal<InjectionPoint> currentInjectionPoint =
new NamedThreadLocal<InjectionPoint>("Current injection point");
new NamedThreadLocal<>("Current injection point");
private final AbstractAutowireCapableBeanFactory beanFactory;
@@ -196,7 +196,7 @@ class ConstructorResolver {
}
// Swallow and try next constructor.
if (causes == null) {
causes = new LinkedList<UnsatisfiedDependencyException>();
causes = new LinkedList<>();
}
causes.add(ex);
continue;
@@ -222,7 +222,7 @@ class ConstructorResolver {
}
else if (constructorToUse != null && typeDiffWeight == minTypeDiffWeight) {
if (ambiguousConstructors == null) {
ambiguousConstructors = new LinkedHashSet<Constructor<?>>();
ambiguousConstructors = new LinkedHashSet<>();
ambiguousConstructors.add(constructorToUse);
}
ambiguousConstructors.add(candidate);
@@ -422,7 +422,7 @@ class ConstructorResolver {
factoryClass = ClassUtils.getUserClass(factoryClass);
Method[] rawCandidates = getCandidateMethods(factoryClass, mbd);
List<Method> candidateSet = new ArrayList<Method>();
List<Method> candidateSet = new ArrayList<>();
for (Method candidate : rawCandidates) {
if (Modifier.isStatic(candidate.getModifiers()) == isStatic && mbd.isFactoryMethod(candidate)) {
candidateSet.add(candidate);
@@ -474,7 +474,7 @@ class ConstructorResolver {
}
// Swallow and try next overloaded factory method.
if (causes == null) {
causes = new LinkedList<UnsatisfiedDependencyException>();
causes = new LinkedList<>();
}
causes.add(ex);
continue;
@@ -509,7 +509,7 @@ class ConstructorResolver {
paramTypes.length == factoryMethodToUse.getParameterTypes().length &&
!Arrays.equals(paramTypes, factoryMethodToUse.getParameterTypes())) {
if (ambiguousFactoryMethods == null) {
ambiguousFactoryMethods = new LinkedHashSet<Method>();
ambiguousFactoryMethods = new LinkedHashSet<>();
ambiguousFactoryMethods.add(factoryMethodToUse);
}
ambiguousFactoryMethods.add(candidate);
@@ -525,14 +525,14 @@ class ConstructorResolver {
}
throw ex;
}
List<String> argTypes = new ArrayList<String>(minNrOfArgs);
List<String> argTypes = new ArrayList<>(minNrOfArgs);
if (explicitArgs != null) {
for (Object arg : explicitArgs) {
argTypes.add(arg != null ? arg.getClass().getSimpleName() : "null");
}
}
else {
Set<ValueHolder> valueHolders = new LinkedHashSet<ValueHolder>(resolvedValues.getArgumentCount());
Set<ValueHolder> valueHolders = new LinkedHashSet<>(resolvedValues.getArgumentCount());
valueHolders.addAll(resolvedValues.getIndexedArgumentValues().values());
valueHolders.addAll(resolvedValues.getGenericArgumentValues());
for (ValueHolder value : valueHolders) {
@@ -670,8 +670,8 @@ class ConstructorResolver {
ArgumentsHolder args = new ArgumentsHolder(paramTypes.length);
Set<ConstructorArgumentValues.ValueHolder> usedValueHolders =
new HashSet<ConstructorArgumentValues.ValueHolder>(paramTypes.length);
Set<String> autowiredBeanNames = new LinkedHashSet<String>(4);
new HashSet<>(paramTypes.length);
Set<String> autowiredBeanNames = new LinkedHashSet<>(4);
for (int paramIndex = 0; paramIndex < paramTypes.length; paramIndex++) {
Class<?> paramType = paramTypes[paramIndex];

View File

@@ -128,7 +128,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
/** Map from serialized id to factory instance */
private static final Map<String, Reference<DefaultListableBeanFactory>> serializableFactories =
new ConcurrentHashMap<String, Reference<DefaultListableBeanFactory>>(8);
new ConcurrentHashMap<>(8);
/** Optional id for this factory, for serialization purposes */
private String serializationId;
@@ -146,22 +146,22 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
private AutowireCandidateResolver autowireCandidateResolver = new SimpleAutowireCandidateResolver();
/** Map from dependency type to corresponding autowired value */
private final Map<Class<?>, Object> resolvableDependencies = new ConcurrentHashMap<Class<?>, Object>(16);
private final Map<Class<?>, Object> resolvableDependencies = new ConcurrentHashMap<>(16);
/** Map of bean definition objects, keyed by bean name */
private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<String, BeanDefinition>(256);
private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<>(256);
/** Map of singleton and non-singleton bean names, keyed by dependency type */
private final Map<Class<?>, String[]> allBeanNamesByType = new ConcurrentHashMap<Class<?>, String[]>(64);
private final Map<Class<?>, String[]> allBeanNamesByType = new ConcurrentHashMap<>(64);
/** Map of singleton-only bean names, keyed by dependency type */
private final Map<Class<?>, String[]> singletonBeanNamesByType = new ConcurrentHashMap<Class<?>, String[]>(64);
private final Map<Class<?>, String[]> singletonBeanNamesByType = new ConcurrentHashMap<>(64);
/** List of bean definition names, in registration order */
private volatile List<String> beanDefinitionNames = new ArrayList<String>(256);
private volatile List<String> beanDefinitionNames = new ArrayList<>(256);
/** List of names of manually registered singletons, in registration order */
private volatile Set<String> manualSingletonNames = new LinkedHashSet<String>(16);
private volatile Set<String> manualSingletonNames = new LinkedHashSet<>(16);
/** Cached array of bean definition names in case of frozen configuration */
private volatile String[] frozenBeanDefinitionNames;
@@ -192,7 +192,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
*/
public void setSerializationId(String serializationId) {
if (serializationId != null) {
serializableFactories.put(serializationId, new WeakReference<DefaultListableBeanFactory>(this));
serializableFactories.put(serializationId, new WeakReference<>(this));
}
else if (this.serializationId != null) {
serializableFactories.remove(this.serializationId);
@@ -328,7 +328,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
Assert.notNull(requiredType, "Required type must not be null");
String[] beanNames = getBeanNamesForType(requiredType);
if (beanNames.length > 1) {
ArrayList<String> autowireCandidates = new ArrayList<String>();
ArrayList<String> autowireCandidates = new ArrayList<>();
for (String beanName : beanNames) {
if (!containsBeanDefinition(beanName) || getBeanDefinition(beanName).isAutowireCandidate()) {
autowireCandidates.add(beanName);
@@ -342,7 +342,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
return getBean(beanNames[0], requiredType, args);
}
else if (beanNames.length > 1) {
Map<String, Object> candidates = new HashMap<String, Object>();
Map<String, Object> candidates = new HashMap<>();
for (String beanName : beanNames) {
candidates.put(beanName, getBean(beanName, requiredType, args));
}
@@ -419,7 +419,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
}
private String[] doGetBeanNamesForType(ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit) {
List<String> result = new ArrayList<String>();
List<String> result = new ArrayList<>();
// Check all bean definitions.
for (String beanName : this.beanDefinitionNames) {
@@ -519,7 +519,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
throws BeansException {
String[] beanNames = getBeanNamesForType(type, includeNonSingletons, allowEagerInit);
Map<String, T> result = new LinkedHashMap<String, T>(beanNames.length);
Map<String, T> result = new LinkedHashMap<>(beanNames.length);
for (String beanName : beanNames) {
try {
result.put(beanName, getBean(beanName, type));
@@ -547,7 +547,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
@Override
public String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType) {
List<String> results = new ArrayList<String>();
List<String> results = new ArrayList<>();
for (String beanName : this.beanDefinitionNames) {
BeanDefinition beanDefinition = getBeanDefinition(beanName);
if (!beanDefinition.isAbstract() && findAnnotationOnBean(beanName, annotationType) != null) {
@@ -565,7 +565,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
@Override
public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) {
String[] beanNames = getBeanNamesForAnnotation(annotationType);
Map<String, Object> results = new LinkedHashMap<String, Object>(beanNames.length);
Map<String, Object> results = new LinkedHashMap<>(beanNames.length);
for (String beanName : beanNames) {
results.put(beanName, getBean(beanName));
}
@@ -695,7 +695,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
@Override
public Iterator<String> getBeanNamesIterator() {
CompositeIterator<String> iterator = new CompositeIterator<String>();
CompositeIterator<String> iterator = new CompositeIterator<>();
iterator.add(this.beanDefinitionNames.iterator());
iterator.add(this.manualSingletonNames.iterator());
return iterator;
@@ -736,7 +736,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
// Iterate over a copy to allow for init methods which in turn register new bean definitions.
// While this may not be part of the regular factory bootstrap, it does otherwise work fine.
List<String> beanNames = new ArrayList<String>(this.beanDefinitionNames);
List<String> beanNames = new ArrayList<>(this.beanDefinitionNames);
// Trigger initialization of all non-lazy singleton beans...
for (String beanName : beanNames) {
@@ -848,12 +848,12 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
// Cannot modify startup-time collection elements anymore (for stable iteration)
synchronized (this.beanDefinitionMap) {
this.beanDefinitionMap.put(beanName, beanDefinition);
List<String> updatedDefinitions = new ArrayList<String>(this.beanDefinitionNames.size() + 1);
List<String> updatedDefinitions = new ArrayList<>(this.beanDefinitionNames.size() + 1);
updatedDefinitions.addAll(this.beanDefinitionNames);
updatedDefinitions.add(beanName);
this.beanDefinitionNames = updatedDefinitions;
if (this.manualSingletonNames.contains(beanName)) {
Set<String> updatedSingletons = new LinkedHashSet<String>(this.manualSingletonNames);
Set<String> updatedSingletons = new LinkedHashSet<>(this.manualSingletonNames);
updatedSingletons.remove(beanName);
this.manualSingletonNames = updatedSingletons;
}
@@ -888,7 +888,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
if (hasBeanCreationStarted()) {
// Cannot modify startup-time collection elements anymore (for stable iteration)
synchronized (this.beanDefinitionMap) {
List<String> updatedDefinitions = new ArrayList<String>(this.beanDefinitionNames);
List<String> updatedDefinitions = new ArrayList<>(this.beanDefinitionNames);
updatedDefinitions.remove(beanName);
this.beanDefinitionNames = updatedDefinitions;
}
@@ -943,7 +943,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
// Cannot modify startup-time collection elements anymore (for stable iteration)
synchronized (this.beanDefinitionMap) {
if (!this.beanDefinitionMap.containsKey(beanName)) {
Set<String> updatedSingletons = new LinkedHashSet<String>(this.manualSingletonNames.size() + 1);
Set<String> updatedSingletons = new LinkedHashSet<>(this.manualSingletonNames.size() + 1);
updatedSingletons.addAll(this.manualSingletonNames);
updatedSingletons.add(beanName);
this.manualSingletonNames = updatedSingletons;
@@ -1162,7 +1162,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
}
private FactoryAwareOrderSourceProvider createFactoryAwareOrderSourceProvider(Map<String, Object> beans) {
IdentityHashMap<Object, String> instancesToBeanNames = new IdentityHashMap<Object, String>();
IdentityHashMap<Object, String> instancesToBeanNames = new IdentityHashMap<>();
for (Map.Entry<String, Object> entry : beans.entrySet()) {
instancesToBeanNames.put(entry.getValue(), entry.getKey());
}
@@ -1187,7 +1187,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
String[] candidateNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(
this, requiredType, true, descriptor.isEager());
Map<String, Object> result = new LinkedHashMap<String, Object>(candidateNames.length);
Map<String, Object> result = new LinkedHashMap<>(candidateNames.length);
for (Class<?> autowiringType : this.resolvableDependencies.keySet()) {
if (autowiringType.isAssignableFrom(requiredType)) {
Object autowiringValue = this.resolvableDependencies.get(autowiringType);
@@ -1603,7 +1603,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
if (beanDefinition == null) {
return null;
}
List<Object> sources = new ArrayList<Object>();
List<Object> sources = new ArrayList<>();
Method factoryMethod = beanDefinition.getResolvedFactoryMethod();
if (factoryMethod != null) {
sources.add(factoryMethod);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,16 +83,16 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
protected final Log logger = LogFactory.getLog(getClass());
/** Cache of singleton objects: bean name --> bean instance */
private final Map<String, Object> singletonObjects = new ConcurrentHashMap<String, Object>(256);
private final Map<String, Object> singletonObjects = new ConcurrentHashMap<>(256);
/** Cache of singleton factories: bean name --> ObjectFactory */
private final Map<String, ObjectFactory<?>> singletonFactories = new HashMap<String, ObjectFactory<?>>(16);
private final Map<String, ObjectFactory<?>> singletonFactories = new HashMap<>(16);
/** Cache of early singleton objects: bean name --> bean instance */
private final Map<String, Object> earlySingletonObjects = new HashMap<String, Object>(16);
private final Map<String, Object> earlySingletonObjects = new HashMap<>(16);
/** Set of registered singletons, containing the bean names in registration order */
private final Set<String> registeredSingletons = new LinkedHashSet<String>(256);
private final Set<String> registeredSingletons = new LinkedHashSet<>(256);
/** Names of beans that are currently in creation */
private final Set<String> singletonsCurrentlyInCreation =
@@ -109,16 +109,16 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
private boolean singletonsCurrentlyInDestruction = false;
/** Disposable bean instances: bean name --> disposable instance */
private final Map<String, Object> disposableBeans = new LinkedHashMap<String, Object>();
private final Map<String, Object> disposableBeans = new LinkedHashMap<>();
/** Map between containing bean names: bean name --> Set of bean names that the bean contains */
private final Map<String, Set<String>> containedBeanMap = new ConcurrentHashMap<String, Set<String>>(16);
private final Map<String, Set<String>> containedBeanMap = new ConcurrentHashMap<>(16);
/** Map between dependent bean names: bean name --> Set of dependent bean names */
private final Map<String, Set<String>> dependentBeanMap = new ConcurrentHashMap<String, Set<String>>(64);
private final Map<String, Set<String>> dependentBeanMap = new ConcurrentHashMap<>(64);
/** Map between depending bean names: bean name --> Set of bean names for the bean's dependencies */
private final Map<String, Set<String>> dependenciesForBeanMap = new ConcurrentHashMap<String, Set<String>>(64);
private final Map<String, Set<String>> dependenciesForBeanMap = new ConcurrentHashMap<>(64);
@Override
@@ -224,7 +224,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
boolean newSingleton = false;
boolean recordSuppressedExceptions = (this.suppressedExceptions == null);
if (recordSuppressedExceptions) {
this.suppressedExceptions = new LinkedHashSet<Exception>();
this.suppressedExceptions = new LinkedHashSet<>();
}
try {
singletonObject = singletonFactory.getObject();
@@ -396,7 +396,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
synchronized (this.containedBeanMap) {
containedBeans = this.containedBeanMap.get(containingBeanName);
if (containedBeans == null) {
containedBeans = new LinkedHashSet<String>(8);
containedBeans = new LinkedHashSet<>(8);
this.containedBeanMap.put(containingBeanName, containedBeans);
}
containedBeans.add(containedBeanName);
@@ -422,7 +422,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
synchronized (this.dependentBeanMap) {
dependentBeans = this.dependentBeanMap.get(canonicalName);
if (dependentBeans == null) {
dependentBeans = new LinkedHashSet<String>(8);
dependentBeans = new LinkedHashSet<>(8);
this.dependentBeanMap.put(canonicalName, dependentBeans);
}
dependentBeans.add(dependentBeanName);
@@ -430,7 +430,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
synchronized (this.dependenciesForBeanMap) {
Set<String> dependenciesForBean = this.dependenciesForBeanMap.get(dependentBeanName);
if (dependenciesForBean == null) {
dependenciesForBean = new LinkedHashSet<String>(8);
dependenciesForBean = new LinkedHashSet<>(8);
this.dependenciesForBeanMap.put(dependentBeanName, dependenciesForBean);
}
dependenciesForBean.add(canonicalName);
@@ -462,7 +462,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
}
for (String transitiveDependency : dependentBeans) {
if (alreadySeen == null) {
alreadySeen = new HashSet<String>();
alreadySeen = new HashSet<>();
}
alreadySeen.add(beanName);
if (isDependent(transitiveDependency, dependentBeanName, alreadySeen)) {

View File

@@ -220,7 +220,7 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
private List<DestructionAwareBeanPostProcessor> filterPostProcessors(List<BeanPostProcessor> processors, Object bean) {
List<DestructionAwareBeanPostProcessor> filteredPostProcessors = null;
if (!CollectionUtils.isEmpty(processors)) {
filteredPostProcessors = new ArrayList<DestructionAwareBeanPostProcessor>(processors.size());
filteredPostProcessors = new ArrayList<>(processors.size());
for (BeanPostProcessor processor : processors) {
if (processor instanceof DestructionAwareBeanPostProcessor) {
DestructionAwareBeanPostProcessor dabpp = (DestructionAwareBeanPostProcessor) processor;
@@ -388,7 +388,7 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
protected Object writeReplace() {
List<DestructionAwareBeanPostProcessor> serializablePostProcessors = null;
if (this.beanPostProcessors != null) {
serializablePostProcessors = new ArrayList<DestructionAwareBeanPostProcessor>();
serializablePostProcessors = new ArrayList<>();
for (DestructionAwareBeanPostProcessor postProcessor : this.beanPostProcessors) {
if (postProcessor instanceof Serializable) {
serializablePostProcessors.add(postProcessor);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@ import org.springframework.beans.factory.FactoryBeanNotInitializedException;
public abstract class FactoryBeanRegistrySupport extends DefaultSingletonBeanRegistry {
/** Cache of singleton objects created by FactoryBeans: FactoryBean name --> object */
private final Map<String, Object> factoryBeanObjectCache = new ConcurrentHashMap<String, Object>(16);
private final Map<String, Object> factoryBeanObjectCache = new ConcurrentHashMap<>(16);
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -101,7 +101,7 @@ public class ManagedList<E> extends ArrayList<E> implements Mergeable, BeanMetad
if (!(parent instanceof List)) {
throw new IllegalArgumentException("Cannot merge with object of type [" + parent.getClass() + "]");
}
List<E> merged = new ManagedList<E>();
List<E> merged = new ManagedList<>();
merged.addAll((List<E>) parent);
merged.addAll(this);
return merged;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -116,7 +116,7 @@ public class ManagedMap<K, V> extends LinkedHashMap<K, V> implements Mergeable,
if (!(parent instanceof Map)) {
throw new IllegalArgumentException("Cannot merge with object of type [" + parent.getClass() + "]");
}
Map<K, V> merged = new ManagedMap<K, V>();
Map<K, V> merged = new ManagedMap<>();
merged.putAll((Map<K, V>) parent);
merged.putAll(this);
return merged;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,7 +100,7 @@ public class ManagedSet<E> extends LinkedHashSet<E> implements Mergeable, BeanMe
if (!(parent instanceof Set)) {
throw new IllegalArgumentException("Cannot merge with object of type [" + parent.getClass() + "]");
}
Set<E> merged = new ManagedSet<E>();
Set<E> merged = new ManagedSet<>();
merged.addAll((Set<E>) parent);
merged.addAll(this);
return merged;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -289,7 +289,7 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
*/
public int registerBeanDefinitions(ResourceBundle rb, String prefix) throws BeanDefinitionStoreException {
// Simply create a map and call overloaded method.
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<>();
Enumeration<String> keys = rb.getKeys();
while (keys.hasMoreElements()) {
String key = keys.nextElement();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ public class ReplaceOverride extends MethodOverride {
private final String methodReplacerBeanName;
private List<String> typeIdentifiers = new LinkedList<String>();
private List<String> typeIdentifiers = new LinkedList<>();
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -258,7 +258,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
public void registerExternallyManagedConfigMember(Member configMember) {
synchronized (this.postProcessingLock) {
if (this.externallyManagedConfigMembers == null) {
this.externallyManagedConfigMembers = new HashSet<Member>(1);
this.externallyManagedConfigMembers = new HashSet<>(1);
}
this.externallyManagedConfigMembers.add(configMember);
}
@@ -274,7 +274,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
public void registerExternallyManagedInitMethod(String initMethod) {
synchronized (this.postProcessingLock) {
if (this.externallyManagedInitMethods == null) {
this.externallyManagedInitMethods = new HashSet<String>(1);
this.externallyManagedInitMethods = new HashSet<>(1);
}
this.externallyManagedInitMethods.add(initMethod);
}
@@ -290,7 +290,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
public void registerExternallyManagedDestroyMethod(String destroyMethod) {
synchronized (this.postProcessingLock) {
if (this.externallyManagedDestroyMethods == null) {
this.externallyManagedDestroyMethods = new HashSet<String>(1);
this.externallyManagedDestroyMethods = new HashSet<>(1);
}
this.externallyManagedDestroyMethods.add(destroyMethod);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ import org.springframework.util.StringUtils;
public class SimpleBeanDefinitionRegistry extends SimpleAliasRegistry implements BeanDefinitionRegistry {
/** Map of bean definition objects, keyed by bean name */
private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<String, BeanDefinition>(64);
private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<>(64);
@Override

View File

@@ -42,7 +42,7 @@ import org.springframework.util.StringUtils;
*/
public class SimpleInstantiationStrategy implements InstantiationStrategy {
private static final ThreadLocal<Method> currentlyInvokedFactoryMethod = new ThreadLocal<Method>();
private static final ThreadLocal<Method> currentlyInvokedFactoryMethod = new ThreadLocal<>();
/**

View File

@@ -67,7 +67,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
* with singleton bean instances through {@link #addBean} calls.
*/
public StaticListableBeanFactory() {
this.beans = new LinkedHashMap<String, Object>();
this.beans = new LinkedHashMap<>();
}
/**
@@ -249,7 +249,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
@Override
public String[] getBeanNamesForType(ResolvableType type) {
boolean isFactoryType = (type != null && FactoryBean.class.isAssignableFrom(type.getRawClass()));
List<String> matches = new ArrayList<String>();
List<String> matches = new ArrayList<>();
for (Map.Entry<String, Object> entry : this.beans.entrySet()) {
String name = entry.getKey();
Object beanInstance = entry.getValue();
@@ -289,7 +289,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
throws BeansException {
boolean isFactoryType = (type != null && FactoryBean.class.isAssignableFrom(type));
Map<String, T> matches = new LinkedHashMap<String, T>();
Map<String, T> matches = new LinkedHashMap<>();
for (Map.Entry<String, Object> entry : this.beans.entrySet()) {
String beanName = entry.getKey();
@@ -320,7 +320,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
@Override
public String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType) {
List<String> results = new ArrayList<String>();
List<String> results = new ArrayList<>();
for (String beanName : this.beans.keySet()) {
if (findAnnotationOnBean(beanName, annotationType) != null) {
results.add(beanName);
@@ -333,7 +333,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType)
throws BeansException {
Map<String, Object> results = new LinkedHashMap<String, Object>();
Map<String, Object> results = new LinkedHashMap<>();
for (String beanName : this.beans.keySet()) {
if (findAnnotationOnBean(beanName, annotationType) != null) {
results.put(beanName, getBean(beanName));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -250,7 +250,7 @@ public class BeanDefinitionParserDelegate {
* beans-element basis. Duplicate bean ids/names may not exist within the
* same level of beans element nesting, but may be duplicated across levels.
*/
private final Set<String> usedNames = new HashSet<String>();
private final Set<String> usedNames = new HashSet<>();
/**
@@ -429,7 +429,7 @@ public class BeanDefinitionParserDelegate {
String id = ele.getAttribute(ID_ATTRIBUTE);
String nameAttr = ele.getAttribute(NAME_ATTRIBUTE);
List<String> aliases = new ArrayList<String>();
List<String> aliases = new ArrayList<>();
if (StringUtils.hasLength(nameAttr)) {
String[] nameArr = StringUtils.tokenizeToStringArray(nameAttr, MULTI_VALUE_ATTRIBUTE_DELIMITERS);
aliases.addAll(Arrays.asList(nameArr));
@@ -1162,7 +1162,7 @@ public class BeanDefinitionParserDelegate {
public List<Object> parseListElement(Element collectionEle, BeanDefinition bd) {
String defaultElementType = collectionEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
NodeList nl = collectionEle.getChildNodes();
ManagedList<Object> target = new ManagedList<Object>(nl.getLength());
ManagedList<Object> target = new ManagedList<>(nl.getLength());
target.setSource(extractSource(collectionEle));
target.setElementTypeName(defaultElementType);
target.setMergeEnabled(parseMergeAttribute(collectionEle));
@@ -1176,7 +1176,7 @@ public class BeanDefinitionParserDelegate {
public Set<Object> parseSetElement(Element collectionEle, BeanDefinition bd) {
String defaultElementType = collectionEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
NodeList nl = collectionEle.getChildNodes();
ManagedSet<Object> target = new ManagedSet<Object>(nl.getLength());
ManagedSet<Object> target = new ManagedSet<>(nl.getLength());
target.setSource(extractSource(collectionEle));
target.setElementTypeName(defaultElementType);
target.setMergeEnabled(parseMergeAttribute(collectionEle));
@@ -1203,7 +1203,7 @@ public class BeanDefinitionParserDelegate {
String defaultValueType = mapEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
List<Element> entryEles = DomUtils.getChildElementsByTagName(mapEle, ENTRY_ELEMENT);
ManagedMap<Object, Object> map = new ManagedMap<Object, Object>(entryEles.size());
ManagedMap<Object, Object> map = new ManagedMap<>(entryEles.size());
map.setSource(extractSource(mapEle));
map.setKeyTypeName(defaultKeyType);
map.setValueTypeName(defaultValueType);

View File

@@ -209,7 +209,7 @@ public class DefaultBeanDefinitionDocumentReader implements BeanDefinitionDocume
// Resolve system properties: e.g. "${user.dir}"
location = getReaderContext().getEnvironment().resolveRequiredPlaceholders(location);
Set<Resource> actualResources = new LinkedHashSet<Resource>(4);
Set<Resource> actualResources = new LinkedHashSet<>(4);
// Discover whether the location is an absolute or relative URI
boolean absoluteLocation = false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -156,7 +156,7 @@ public class DefaultNamespaceHandlerResolver implements NamespaceHandlerResolver
if (logger.isDebugEnabled()) {
logger.debug("Loaded NamespaceHandler mappings: " + mappings);
}
Map<String, Object> handlerMappings = new ConcurrentHashMap<String, Object>(mappings.size());
Map<String, Object> handlerMappings = new ConcurrentHashMap<>(mappings.size());
CollectionUtils.mergePropertiesIntoMap(mappings, handlerMappings);
this.handlerMappings = handlerMappings;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,21 +48,21 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler {
* local name of the {@link Element Elements} they handle.
*/
private final Map<String, BeanDefinitionParser> parsers =
new HashMap<String, BeanDefinitionParser>();
new HashMap<>();
/**
* Stores the {@link BeanDefinitionDecorator} implementations keyed by the
* local name of the {@link Element Elements} they handle.
*/
private final Map<String, BeanDefinitionDecorator> decorators =
new HashMap<String, BeanDefinitionDecorator>();
new HashMap<>();
/**
* Stores the {@link BeanDefinitionDecorator} implementations keyed by the local
* name of the {@link Attr Attrs} they handle.
*/
private final Map<String, BeanDefinitionDecorator> attributeDecorators =
new HashMap<String, BeanDefinitionDecorator>();
new HashMap<>();
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@ public final class ParserContext {
private BeanDefinition containingBeanDefinition;
private final Stack<ComponentDefinition> containingComponents = new Stack<ComponentDefinition>();
private final Stack<ComponentDefinition> containingComponents = new Stack<>();
public ParserContext(XmlReaderContext readerContext, BeanDefinitionParserDelegate delegate) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -146,7 +146,7 @@ public class PluggableSchemaResolver implements EntityResolver {
if (logger.isDebugEnabled()) {
logger.debug("Loaded schema mappings: " + mappings);
}
Map<String, String> schemaMappings = new ConcurrentHashMap<String, String>(mappings.size());
Map<String, String> schemaMappings = new ConcurrentHashMap<>(mappings.size());
CollectionUtils.mergePropertiesIntoMap(mappings, schemaMappings);
this.schemaMappings = schemaMappings;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -123,7 +123,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
private final XmlValidationModeDetector validationModeDetector = new XmlValidationModeDetector();
private final ThreadLocal<Set<EncodedResource>> resourcesCurrentlyBeingLoaded =
new NamedThreadLocal<Set<EncodedResource>>("XML bean definition resources currently being loaded");
new NamedThreadLocal<>("XML bean definition resources currently being loaded");
/**
@@ -319,7 +319,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
Set<EncodedResource> currentResources = this.resourcesCurrentlyBeingLoaded.get();
if (currentResources == null) {
currentResources = new HashSet<EncodedResource>(4);
currentResources = new HashSet<>(4);
this.resourcesCurrentlyBeingLoaded.set(currentResources);
}
if (!currentResources.add(encodedResource)) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -160,13 +160,13 @@ public class CustomCollectionEditor extends PropertyEditorSupport {
}
}
else if (List.class == collectionType) {
return new ArrayList<Object>(initialCapacity);
return new ArrayList<>(initialCapacity);
}
else if (SortedSet.class == collectionType) {
return new TreeSet<Object>();
return new TreeSet<>();
}
else {
return new LinkedHashSet<Object>(initialCapacity);
return new LinkedHashSet<>(initialCapacity);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -138,10 +138,10 @@ public class CustomMapEditor extends PropertyEditorSupport {
}
}
else if (SortedMap.class == mapType) {
return new TreeMap<Object, Object>();
return new TreeMap<>();
}
else {
return new LinkedHashMap<Object, Object>(initialCapacity);
return new LinkedHashMap<>(initialCapacity);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,7 +78,7 @@ public class PagedListHolder<E> implements Serializable {
* @see #setSource
*/
public PagedListHolder() {
this(new ArrayList<E>(0));
this(new ArrayList<>(0));
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -147,7 +147,7 @@ public class PropertyComparator<T> implements Comparator<T> {
*/
public static void sort(Object[] source, SortDefinition sortDefinition) throws BeansException {
if (StringUtils.hasText(sortDefinition.getProperty())) {
Arrays.sort(source, new PropertyComparator<Object>(sortDefinition));
Arrays.sort(source, new PropertyComparator<>(sortDefinition));
}
}

View File

@@ -440,7 +440,7 @@ public abstract class AbstractPropertyAccessorTests {
AbstractPropertyAccessor accessor = createAccessor(target);
accessor.setConversionService(new DefaultConversionService());
accessor.setAutoGrowNestedPaths(true);
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
map.put("favoriteNumber", "9");
accessor.setPropertyValue("list[0]", map);
assertEquals(map, target.list.get(0));
@@ -820,7 +820,7 @@ public abstract class AbstractPropertyAccessorTests {
assertTrue("correct values", target.stringArray[0].equals("foo") && target.stringArray[1].equals("fi") &&
target.stringArray[2].equals("fi") && target.stringArray[3].equals("fum"));
List<String> list = new ArrayList<String>();
List<String> list = new ArrayList<>();
list.add("foo");
list.add("fi");
list.add("fi");
@@ -830,7 +830,7 @@ public abstract class AbstractPropertyAccessorTests {
assertTrue("correct values", target.stringArray[0].equals("foo") && target.stringArray[1].equals("fi") &&
target.stringArray[2].equals("fi") && target.stringArray[3].equals("fum"));
Set<String> set = new HashSet<String>();
Set<String> set = new HashSet<>();
set.add("foo");
set.add("fi");
set.add("fum");
@@ -863,7 +863,7 @@ public abstract class AbstractPropertyAccessorTests {
assertTrue("correct values", target.stringArray[0].equals("foo") && target.stringArray[1].equals("fi") &&
target.stringArray[2].equals("fi") && target.stringArray[3].equals("fum"));
List<String> list = new ArrayList<String>();
List<String> list = new ArrayList<>();
list.add("4foo");
list.add("7fi");
list.add("6fi");
@@ -873,7 +873,7 @@ public abstract class AbstractPropertyAccessorTests {
assertTrue("correct values", target.stringArray[0].equals("foo") && target.stringArray[1].equals("fi") &&
target.stringArray[2].equals("fi") && target.stringArray[3].equals("fum"));
Set<String> set = new HashSet<String>();
Set<String> set = new HashSet<>();
set.add("4foo");
set.add("7fi");
set.add("6fum");
@@ -1142,7 +1142,7 @@ public abstract class AbstractPropertyAccessorTests {
public void setGenericArrayProperty() {
SkipReaderStub target = new SkipReaderStub();
AbstractPropertyAccessor accessor = createAccessor(target);
List<String> values = new LinkedList<String>();
List<String> values = new LinkedList<>();
values.add("1");
values.add("2");
values.add("3");
@@ -1175,16 +1175,16 @@ public abstract class AbstractPropertyAccessorTests {
public void setCollectionProperty() {
IndexedTestBean target = new IndexedTestBean();
AbstractPropertyAccessor accessor = createAccessor(target);
Collection<String> coll = new HashSet<String>();
Collection<String> coll = new HashSet<>();
coll.add("coll1");
accessor.setPropertyValue("collection", coll);
Set<String> set = new HashSet<String>();
Set<String> set = new HashSet<>();
set.add("set1");
accessor.setPropertyValue("set", set);
SortedSet<String> sortedSet = new TreeSet<String>();
SortedSet<String> sortedSet = new TreeSet<>();
sortedSet.add("sortedSet1");
accessor.setPropertyValue("sortedSet", sortedSet);
List<String> list = new LinkedList<String>();
List<String> list = new LinkedList<>();
list.add("list1");
accessor.setPropertyValue("list", list);
assertSame(coll, target.getCollection());
@@ -1198,16 +1198,16 @@ public abstract class AbstractPropertyAccessorTests {
public void setCollectionPropertyNonMatchingType() {
IndexedTestBean target = new IndexedTestBean();
AbstractPropertyAccessor accessor = createAccessor(target);
Collection<String> coll = new ArrayList<String>();
Collection<String> coll = new ArrayList<>();
coll.add("coll1");
accessor.setPropertyValue("collection", coll);
List<String> set = new LinkedList<String>();
List<String> set = new LinkedList<>();
set.add("set1");
accessor.setPropertyValue("set", set);
List<String> sortedSet = new ArrayList<String>();
List<String> sortedSet = new ArrayList<>();
sortedSet.add("sortedSet1");
accessor.setPropertyValue("sortedSet", sortedSet);
Set<String> list = new HashSet<String>();
Set<String> list = new HashSet<>();
list.add("list1");
accessor.setPropertyValue("list", list);
assertEquals(1, target.getCollection().size());
@@ -1225,16 +1225,16 @@ public abstract class AbstractPropertyAccessorTests {
public void setCollectionPropertyWithArrayValue() {
IndexedTestBean target = new IndexedTestBean();
AbstractPropertyAccessor accessor = createAccessor(target);
Collection<String> coll = new HashSet<String>();
Collection<String> coll = new HashSet<>();
coll.add("coll1");
accessor.setPropertyValue("collection", coll.toArray());
List<String> set = new LinkedList<String>();
List<String> set = new LinkedList<>();
set.add("set1");
accessor.setPropertyValue("set", set.toArray());
List<String> sortedSet = new ArrayList<String>();
List<String> sortedSet = new ArrayList<>();
sortedSet.add("sortedSet1");
accessor.setPropertyValue("sortedSet", sortedSet.toArray());
Set<String> list = new HashSet<String>();
Set<String> list = new HashSet<>();
list.add("list1");
accessor.setPropertyValue("list", list.toArray());
assertEquals(1, target.getCollection().size());
@@ -1252,16 +1252,16 @@ public abstract class AbstractPropertyAccessorTests {
public void setCollectionPropertyWithIntArrayValue() {
IndexedTestBean target = new IndexedTestBean();
AbstractPropertyAccessor accessor = createAccessor(target);
Collection<Integer> coll = new HashSet<Integer>();
Collection<Integer> coll = new HashSet<>();
coll.add(0);
accessor.setPropertyValue("collection", new int[] {0});
List<Integer> set = new LinkedList<Integer>();
List<Integer> set = new LinkedList<>();
set.add(1);
accessor.setPropertyValue("set", new int[] {1});
List<Integer> sortedSet = new ArrayList<Integer>();
List<Integer> sortedSet = new ArrayList<>();
sortedSet.add(2);
accessor.setPropertyValue("sortedSet", new int[] {2});
Set<Integer> list = new HashSet<Integer>();
Set<Integer> list = new HashSet<>();
list.add(3);
accessor.setPropertyValue("list", new int[] {3});
assertEquals(1, target.getCollection().size());
@@ -1279,16 +1279,16 @@ public abstract class AbstractPropertyAccessorTests {
public void setCollectionPropertyWithIntegerValue() {
IndexedTestBean target = new IndexedTestBean();
AbstractPropertyAccessor accessor = createAccessor(target);
Collection<Integer> coll = new HashSet<Integer>();
Collection<Integer> coll = new HashSet<>();
coll.add(0);
accessor.setPropertyValue("collection", new Integer(0));
List<Integer> set = new LinkedList<Integer>();
List<Integer> set = new LinkedList<>();
set.add(1);
accessor.setPropertyValue("set", new Integer(1));
List<Integer> sortedSet = new ArrayList<Integer>();
List<Integer> sortedSet = new ArrayList<>();
sortedSet.add(2);
accessor.setPropertyValue("sortedSet", new Integer(2));
Set<Integer> list = new HashSet<Integer>();
Set<Integer> list = new HashSet<>();
list.add(3);
accessor.setPropertyValue("list", new Integer(3));
assertEquals(1, target.getCollection().size());
@@ -1306,13 +1306,13 @@ public abstract class AbstractPropertyAccessorTests {
public void setCollectionPropertyWithStringValue() {
IndexedTestBean target = new IndexedTestBean();
AbstractPropertyAccessor accessor = createAccessor(target);
List<String> set = new LinkedList<String>();
List<String> set = new LinkedList<>();
set.add("set1");
accessor.setPropertyValue("set", "set1");
List<String> sortedSet = new ArrayList<String>();
List<String> sortedSet = new ArrayList<>();
sortedSet.add("sortedSet1");
accessor.setPropertyValue("sortedSet", "sortedSet1");
Set<String> list = new HashSet<String>();
Set<String> list = new HashSet<>();
list.add("list1");
accessor.setPropertyValue("list", "list1");
assertEquals(1, target.getSet().size());
@@ -1348,7 +1348,7 @@ public abstract class AbstractPropertyAccessorTests {
public void setMapProperty() {
IndexedTestBean target = new IndexedTestBean();
AbstractPropertyAccessor accessor = createAccessor(target);
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
map.put("key", "value");
accessor.setPropertyValue("map", map);
SortedMap<?, ?> sortedMap = new TreeMap<>();
@@ -1362,10 +1362,10 @@ public abstract class AbstractPropertyAccessorTests {
public void setMapPropertyNonMatchingType() {
IndexedTestBean target = new IndexedTestBean();
AbstractPropertyAccessor accessor = createAccessor(target);
Map<String, String> map = new TreeMap<String, String>();
Map<String, String> map = new TreeMap<>();
map.put("key", "value");
accessor.setPropertyValue("map", map);
Map<String, String> sortedMap = new TreeMap<String, String>();
Map<String, String> sortedMap = new TreeMap<>();
sortedMap.put("sortedKey", "sortedValue");
accessor.setPropertyValue("sortedMap", sortedMap);
assertEquals(1, target.getMap().size());
@@ -1422,7 +1422,7 @@ public abstract class AbstractPropertyAccessorTests {
}
});
Map<Integer, String> inputMap = new HashMap<Integer, String>();
Map<Integer, String> inputMap = new HashMap<>();
inputMap.put(1, "rod");
inputMap.put(2, "rob");
MutablePropertyValues pvs = new MutablePropertyValues();
@@ -1446,7 +1446,7 @@ public abstract class AbstractPropertyAccessorTests {
}
});
Map<Object, Object> inputMap = new HashMap<Object, Object>();
Map<Object, Object> inputMap = new HashMap<>();
inputMap.put(1, "rod");
inputMap.put(2, "rob");
MutablePropertyValues pvs = new MutablePropertyValues();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ public abstract class AbstractPropertyValuesTests {
assertTrue("Doesn't contain tory", !pvs.contains("tory"));
PropertyValue[] ps = pvs.getPropertyValues();
Map<String, String> m = new HashMap<String, String>();
Map<String, String> m = new HashMap<>();
m.put("forname", "Tony");
m.put("surname", "Blair");
m.put("age", "50");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ public final class BeanWrapperEnumTests {
@Test
public void testCustomEnum() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnum", "VALUE_1");
assertEquals(CustomEnum.VALUE_1, gb.getCustomEnum());
@@ -43,7 +43,7 @@ public final class BeanWrapperEnumTests {
@Test
public void testCustomEnumWithNull() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnum", null);
assertEquals(null, gb.getCustomEnum());
@@ -51,7 +51,7 @@ public final class BeanWrapperEnumTests {
@Test
public void testCustomEnumWithEmptyString() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnum", "");
assertEquals(null, gb.getCustomEnum());
@@ -59,7 +59,7 @@ public final class BeanWrapperEnumTests {
@Test
public void testCustomEnumArrayWithSingleValue() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumArray", "VALUE_1");
assertEquals(1, gb.getCustomEnumArray().length);
@@ -68,7 +68,7 @@ public final class BeanWrapperEnumTests {
@Test
public void testCustomEnumArrayWithMultipleValues() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumArray", new String[] {"VALUE_1", "VALUE_2"});
assertEquals(2, gb.getCustomEnumArray().length);
@@ -78,7 +78,7 @@ public final class BeanWrapperEnumTests {
@Test
public void testCustomEnumArrayWithMultipleValuesAsCsv() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumArray", "VALUE_1,VALUE_2");
assertEquals(2, gb.getCustomEnumArray().length);
@@ -88,7 +88,7 @@ public final class BeanWrapperEnumTests {
@Test
public void testCustomEnumSetWithSingleValue() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumSet", "VALUE_1");
assertEquals(1, gb.getCustomEnumSet().size());
@@ -97,7 +97,7 @@ public final class BeanWrapperEnumTests {
@Test
public void testCustomEnumSetWithMultipleValues() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumSet", new String[] {"VALUE_1", "VALUE_2"});
assertEquals(2, gb.getCustomEnumSet().size());
@@ -107,7 +107,7 @@ public final class BeanWrapperEnumTests {
@Test
public void testCustomEnumSetWithMultipleValuesAsCsv() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumSet", "VALUE_1,VALUE_2");
assertEquals(2, gb.getCustomEnumSet().size());
@@ -117,7 +117,7 @@ public final class BeanWrapperEnumTests {
@Test
public void testCustomEnumSetWithGetterSetterMismatch() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("customEnumSetMismatch", new String[] {"VALUE_1", "VALUE_2"});
assertEquals(2, gb.getCustomEnumSet().size());
@@ -127,7 +127,7 @@ public final class BeanWrapperEnumTests {
@Test
public void testStandardEnumSetWithMultipleValues() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setConversionService(new DefaultConversionService());
assertNull(gb.getStandardEnumSet());
@@ -139,7 +139,7 @@ public final class BeanWrapperEnumTests {
@Test
public void testStandardEnumSetWithAutoGrowing() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setAutoGrowNestedPaths(true);
assertNull(gb.getStandardEnumSet());
@@ -149,11 +149,11 @@ public final class BeanWrapperEnumTests {
@Test
public void testStandardEnumMapWithMultipleValues() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setConversionService(new DefaultConversionService());
assertNull(gb.getStandardEnumMap());
Map<String, Integer> map = new LinkedHashMap<String, Integer>();
Map<String, Integer> map = new LinkedHashMap<>();
map.put("VALUE_1", 1);
map.put("VALUE_2", 2);
bw.setPropertyValue("standardEnumMap", map);
@@ -164,7 +164,7 @@ public final class BeanWrapperEnumTests {
@Test
public void testStandardEnumMapWithAutoGrowing() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setAutoGrowNestedPaths(true);
assertNull(gb.getStandardEnumMap());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,9 +51,9 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericSet() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Set<String> input = new HashSet<String>();
Set<String> input = new HashSet<>();
input.add("4");
input.add("5");
bw.setPropertyValue("integerSet", input);
@@ -63,10 +63,10 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericLowerBoundedSet() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, true));
Set<String> input = new HashSet<String>();
Set<String> input = new HashSet<>();
input.add("4");
input.add("5");
bw.setPropertyValue("numberSet", input);
@@ -76,9 +76,9 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericSetWithConversionFailure() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Set<TestBean> input = new HashSet<TestBean>();
Set<TestBean> input = new HashSet<>();
input.add(new TestBean());
try {
bw.setPropertyValue("integerSet", input);
@@ -91,9 +91,9 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericList() throws MalformedURLException {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
List<String> input = new ArrayList<String>();
List<String> input = new ArrayList<>();
input.add("http://localhost:8080");
input.add("http://localhost:9090");
bw.setPropertyValue("resourceList", input);
@@ -103,8 +103,8 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericListElement() throws MalformedURLException {
GenericBean<?> gb = new GenericBean<Object>();
gb.setResourceList(new ArrayList<Resource>());
GenericBean<?> gb = new GenericBean<>();
gb.setResourceList(new ArrayList<>());
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("resourceList[0]", "http://localhost:8080");
assertEquals(new UrlResource("http://localhost:8080"), gb.getResourceList().get(0));
@@ -112,9 +112,9 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericMap() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Map<String, String> input = new HashMap<String, String>();
Map<String, String> input = new HashMap<>();
input.put("4", "5");
input.put("6", "7");
bw.setPropertyValue("shortMap", input);
@@ -124,8 +124,8 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericMapElement() {
GenericBean<?> gb = new GenericBean<Object>();
gb.setShortMap(new HashMap<Short, Integer>());
GenericBean<?> gb = new GenericBean<>();
gb.setShortMap(new HashMap<>());
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("shortMap[4]", "5");
assertEquals(new Integer(5), bw.getPropertyValue("shortMap[4]"));
@@ -134,9 +134,9 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericMapWithKeyType() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Map<String, String> input = new HashMap<String, String>();
Map<String, String> input = new HashMap<>();
input.put("4", "5");
input.put("6", "7");
bw.setPropertyValue("longMap", input);
@@ -146,7 +146,7 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericMapElementWithKeyType() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
gb.setLongMap(new HashMap<Long, Integer>());
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("longMap[4]", "5");
@@ -156,14 +156,14 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericMapWithCollectionValue() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
Map<String, Collection> input = new HashMap<String, Collection>();
HashSet<Integer> value1 = new HashSet<Integer>();
Map<String, Collection> input = new HashMap<>();
HashSet<Integer> value1 = new HashSet<>();
value1.add(new Integer(1));
input.put("1", value1);
ArrayList<Boolean> value2 = new ArrayList<Boolean>();
ArrayList<Boolean> value2 = new ArrayList<>();
value2.add(Boolean.TRUE);
input.put("2", value2);
bw.setPropertyValue("collectionMap", input);
@@ -173,11 +173,11 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericMapElementWithCollectionValue() {
GenericBean<?> gb = new GenericBean<Object>();
gb.setCollectionMap(new HashMap<Number, Collection<? extends Object>>());
GenericBean<?> gb = new GenericBean<>();
gb.setCollectionMap(new HashMap<>());
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
HashSet<Integer> value1 = new HashSet<Integer>();
HashSet<Integer> value1 = new HashSet<>();
value1.add(new Integer(1));
bw.setPropertyValue("collectionMap[1]", value1);
assertTrue(gb.getCollectionMap().get(new Integer(1)) instanceof HashSet);
@@ -185,7 +185,7 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericMapFromProperties() {
GenericBean<?> gb = new GenericBean<Object>();
GenericBean<?> gb = new GenericBean<>();
BeanWrapper bw = new BeanWrapperImpl(gb);
Properties input = new Properties();
input.setProperty("4", "5");
@@ -197,9 +197,9 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericListOfLists() throws MalformedURLException {
GenericBean<String> gb = new GenericBean<String>();
List<List<Integer>> list = new LinkedList<List<Integer>>();
list.add(new LinkedList<Integer>());
GenericBean<String> gb = new GenericBean<>();
List<List<Integer>> list = new LinkedList<>();
list.add(new LinkedList<>());
gb.setListOfLists(list);
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("listOfLists[0][0]", new Integer(5));
@@ -209,9 +209,9 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericListOfListsWithElementConversion() throws MalformedURLException {
GenericBean<String> gb = new GenericBean<String>();
List<List<Integer>> list = new LinkedList<List<Integer>>();
list.add(new LinkedList<Integer>());
GenericBean<String> gb = new GenericBean<>();
List<List<Integer>> list = new LinkedList<>();
list.add(new LinkedList<>());
gb.setListOfLists(list);
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("listOfLists[0][0]", "5");
@@ -221,8 +221,8 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericListOfArrays() throws MalformedURLException {
GenericBean<String> gb = new GenericBean<String>();
ArrayList<String[]> list = new ArrayList<String[]>();
GenericBean<String> gb = new GenericBean<>();
ArrayList<String[]> list = new ArrayList<>();
list.add(new String[] {"str1", "str2"});
gb.setListOfArrays(list);
BeanWrapper bw = new BeanWrapperImpl(gb);
@@ -233,8 +233,8 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericListOfArraysWithElementConversion() throws MalformedURLException {
GenericBean<String> gb = new GenericBean<String>();
ArrayList<String[]> list = new ArrayList<String[]>();
GenericBean<String> gb = new GenericBean<>();
ArrayList<String[]> list = new ArrayList<>();
list.add(new String[] {"str1", "str2"});
gb.setListOfArrays(list);
BeanWrapper bw = new BeanWrapperImpl(gb);
@@ -246,9 +246,9 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericListOfMaps() throws MalformedURLException {
GenericBean<String> gb = new GenericBean<String>();
List<Map<Integer, Long>> list = new LinkedList<Map<Integer, Long>>();
list.add(new HashMap<Integer, Long>());
GenericBean<String> gb = new GenericBean<>();
List<Map<Integer, Long>> list = new LinkedList<>();
list.add(new HashMap<>());
gb.setListOfMaps(list);
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("listOfMaps[0][10]", new Long(5));
@@ -258,9 +258,9 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericListOfMapsWithElementConversion() throws MalformedURLException {
GenericBean<String> gb = new GenericBean<String>();
List<Map<Integer, Long>> list = new LinkedList<Map<Integer, Long>>();
list.add(new HashMap<Integer, Long>());
GenericBean<String> gb = new GenericBean<>();
List<Map<Integer, Long>> list = new LinkedList<>();
list.add(new HashMap<>());
gb.setListOfMaps(list);
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("listOfMaps[0][10]", "5");
@@ -270,9 +270,9 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericMapOfMaps() throws MalformedURLException {
GenericBean<String> gb = new GenericBean<String>();
Map<String, Map<Integer, Long>> map = new HashMap<String, Map<Integer, Long>>();
map.put("mykey", new HashMap<Integer, Long>());
GenericBean<String> gb = new GenericBean<>();
Map<String, Map<Integer, Long>> map = new HashMap<>();
map.put("mykey", new HashMap<>());
gb.setMapOfMaps(map);
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("mapOfMaps[mykey][10]", new Long(5));
@@ -282,9 +282,9 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericMapOfMapsWithElementConversion() throws MalformedURLException {
GenericBean<String> gb = new GenericBean<String>();
Map<String, Map<Integer, Long>> map = new HashMap<String, Map<Integer, Long>>();
map.put("mykey", new HashMap<Integer, Long>());
GenericBean<String> gb = new GenericBean<>();
Map<String, Map<Integer, Long>> map = new HashMap<>();
map.put("mykey", new HashMap<>());
gb.setMapOfMaps(map);
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("mapOfMaps[mykey][10]", "5");
@@ -294,9 +294,9 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericMapOfLists() throws MalformedURLException {
GenericBean<String> gb = new GenericBean<String>();
Map<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>>();
map.put(new Integer(1), new LinkedList<Integer>());
GenericBean<String> gb = new GenericBean<>();
Map<Integer, List<Integer>> map = new HashMap<>();
map.put(new Integer(1), new LinkedList<>());
gb.setMapOfLists(map);
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("mapOfLists[1][0]", new Integer(5));
@@ -306,9 +306,9 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericMapOfListsWithElementConversion() throws MalformedURLException {
GenericBean<String> gb = new GenericBean<String>();
Map<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>>();
map.put(new Integer(1), new LinkedList<Integer>());
GenericBean<String> gb = new GenericBean<>();
Map<Integer, List<Integer>> map = new HashMap<>();
map.put(new Integer(1), new LinkedList<>());
gb.setMapOfLists(map);
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("mapOfLists[1][0]", "5");
@@ -318,7 +318,7 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericTypeNestingMapOfInteger() throws Exception {
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
map.put("testKey", "100");
NestedGenericCollectionBean gb = new NestedGenericCollectionBean();
@@ -331,7 +331,7 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericTypeNestingMapOfListOfInteger() throws Exception {
Map<String, List<String>> map = new HashMap<String, List<String>>();
Map<String, List<String>> map = new HashMap<>();
List<String> list = Arrays.asList(new String[] {"1", "2", "3"});
map.put("testKey", list);
@@ -346,8 +346,8 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericTypeNestingListOfMapOfInteger() throws Exception {
List<Map<String, String>> list = new LinkedList<Map<String, String>>();
Map<String, String> map = new HashMap<String, String>();
List<Map<String, String>> list = new LinkedList<>();
Map<String, String> map = new HashMap<>();
map.put("testKey", "5");
list.add(map);
@@ -362,7 +362,7 @@ public class BeanWrapperGenericsTests {
@Test
public void testGenericTypeNestingMapOfListOfListOfInteger() throws Exception {
Map<String, List<List<String>>> map = new HashMap<String, List<List<String>>>();
Map<String, List<List<String>>> map = new HashMap<>();
List<String> list = Arrays.asList(new String[] {"1", "2", "3"});
map.put("testKey", Collections.singletonList(list));
@@ -377,10 +377,10 @@ public class BeanWrapperGenericsTests {
@Test
public void testComplexGenericMap() {
Map<List<String>, List<String>> inputMap = new HashMap<List<String>, List<String>>();
List<String> inputKey = new LinkedList<String>();
Map<List<String>, List<String>> inputMap = new HashMap<>();
List<String> inputKey = new LinkedList<>();
inputKey.add("1");
List<String> inputValue = new LinkedList<String>();
List<String> inputValue = new LinkedList<>();
inputValue.add("10");
inputMap.put(inputKey, inputValue);
@@ -394,10 +394,10 @@ public class BeanWrapperGenericsTests {
@Test
public void testComplexGenericMapWithCollectionConversion() {
Map<Set<String>, Set<String>> inputMap = new HashMap<Set<String>, Set<String>>();
Set<String> inputKey = new HashSet<String>();
Map<Set<String>, Set<String>> inputMap = new HashMap<>();
Set<String> inputKey = new HashSet<>();
inputKey.add("1");
Set<String> inputValue = new HashSet<String>();
Set<String> inputValue = new HashSet<>();
inputValue.add("10");
inputMap.put(inputKey, inputValue);
@@ -411,7 +411,7 @@ public class BeanWrapperGenericsTests {
@Test
public void testComplexGenericIndexedMapEntry() {
List<String> inputValue = new LinkedList<String>();
List<String> inputValue = new LinkedList<>();
inputValue.add("10");
ComplexMapHolder holder = new ComplexMapHolder();
@@ -424,7 +424,7 @@ public class BeanWrapperGenericsTests {
@Test
public void testComplexGenericIndexedMapEntryWithCollectionConversion() {
Set<String> inputValue = new HashSet<String>();
Set<String> inputValue = new HashSet<>();
inputValue.add("10");
ComplexMapHolder holder = new ComplexMapHolder();
@@ -437,7 +437,7 @@ public class BeanWrapperGenericsTests {
@Test
public void testComplexDerivedIndexedMapEntry() {
List<String> inputValue = new LinkedList<String>();
List<String> inputValue = new LinkedList<>();
inputValue.add("10");
ComplexMapHolder holder = new ComplexMapHolder();
@@ -450,7 +450,7 @@ public class BeanWrapperGenericsTests {
@Test
public void testComplexDerivedIndexedMapEntryWithCollectionConversion() {
Set<String> inputValue = new HashSet<String>();
Set<String> inputValue = new HashSet<>();
inputValue.add("10");
ComplexMapHolder holder = new ComplexMapHolder();
@@ -511,9 +511,9 @@ public class BeanWrapperGenericsTests {
}
}
Map<String, Object> data = new HashMap<String, Object>();
Map<String, Object> data = new HashMap<>();
data.put("x", "y");
Holder<Map<String, Object>> context = new Holder<Map<String,Object>>(data);
Holder<Map<String, Object>> context = new Holder<>(data);
BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(context);
assertEquals("y", bw.getPropertyValue("data['x']"));
@@ -586,7 +586,7 @@ public class BeanWrapperGenericsTests {
private Map<List<Integer>, List<Long>> genericMap;
private Map<Integer, List<Long>> genericIndexedMap = new HashMap<Integer, List<Long>>();
private Map<Integer, List<Long>> genericIndexedMap = new HashMap<>();
private DerivedMap derivedIndexedMap = new DerivedMap();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -101,7 +101,7 @@ public final class ConcurrentBeanFactoryTests {
run.setDaemon(true);
set.add(run);
}
for (Iterator<TestRun> it = new HashSet<TestRun>(set).iterator(); it.hasNext();) {
for (Iterator<TestRun> it = new HashSet<>(set).iterator(); it.hasNext();) {
TestRun run = it.next();
run.start();
}

View File

@@ -2216,7 +2216,7 @@ public class DefaultListableBeanFactoryTests {
@Test
public void testPrototypeWithArrayConversionForConstructor() {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
List<String> list = new ManagedList<String>();
List<String> list = new ManagedList<>();
list.add("myName");
list.add("myBeanName");
RootBeanDefinition bd = new RootBeanDefinition(DerivedTestBean.class);
@@ -2235,7 +2235,7 @@ public class DefaultListableBeanFactoryTests {
@Test
public void testPrototypeWithArrayConversionForFactoryMethod() {
DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
List<String> list = new ManagedList<String>();
List<String> list = new ManagedList<>();
list.add("myName");
list.add("myBeanName");
RootBeanDefinition bd = new RootBeanDefinition(DerivedTestBean.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -272,7 +272,7 @@ public class FactoryBeanTests {
public static class CountingPostProcessor implements BeanPostProcessor {
private final Map<String, AtomicInteger> count = new HashMap<String, AtomicInteger>();
private final Map<String, AtomicInteger> count = new HashMap<>();
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) {

View File

@@ -918,7 +918,7 @@ public class AutowiredAnnotationBeanPostProcessorTests {
RootBeanDefinition tbm = new RootBeanDefinition(CollectionFactoryMethods.class);
tbm.setUniqueFactoryMethodName("testBeanMap");
bf.registerBeanDefinition("myTestBeanMap", tbm);
bf.registerSingleton("otherMap", new HashMap<Object, Object>());
bf.registerSingleton("otherMap", new HashMap<>());
MapConstructorInjectionBean bean = (MapConstructorInjectionBean) bf.getBean("annotatedBean");
assertSame(bf.getBean("myTestBeanMap"), bean.getTestBeanMap());
@@ -940,7 +940,7 @@ public class AutowiredAnnotationBeanPostProcessorTests {
tbs.add(new TestBean("tb1"));
tbs.add(new TestBean("tb2"));
bf.registerSingleton("testBeans", tbs);
bf.registerSingleton("otherSet", new HashSet<Object>());
bf.registerSingleton("otherSet", new HashSet<>());
SetConstructorInjectionBean bean = (SetConstructorInjectionBean) bf.getBean("annotatedBean");
assertSame(tbs, bean.getTestBeanSet());
@@ -961,7 +961,7 @@ public class AutowiredAnnotationBeanPostProcessorTests {
RootBeanDefinition tbs = new RootBeanDefinition(CollectionFactoryMethods.class);
tbs.setUniqueFactoryMethodName("testBeanSet");
bf.registerBeanDefinition("myTestBeanSet", tbs);
bf.registerSingleton("otherSet", new HashSet<Object>());
bf.registerSingleton("otherSet", new HashSet<>());
SetConstructorInjectionBean bean = (SetConstructorInjectionBean) bf.getBean("annotatedBean");
assertSame(bf.getBean("myTestBeanSet"), bean.getTestBeanSet());
@@ -3101,7 +3101,7 @@ public class AutowiredAnnotationBeanPostProcessorTests {
}
public static GenericInterface1<String> createErased() {
return new GenericInterface1Impl<String>();
return new GenericInterface1Impl<>();
}
@SuppressWarnings("rawtypes")
@@ -3257,14 +3257,14 @@ public class AutowiredAnnotationBeanPostProcessorTests {
public static class CollectionFactoryMethods {
public static Map<String, TestBean> testBeanMap() {
Map<String, TestBean> tbm = new LinkedHashMap<String, TestBean>();
Map<String, TestBean> tbm = new LinkedHashMap<>();
tbm.put("testBean1", new TestBean("tb1"));
tbm.put("testBean2", new TestBean("tb2"));
return tbm;
}
public static Set<TestBean> testBeanSet() {
Set<TestBean> tbs = new LinkedHashSet<TestBean>();
Set<TestBean> tbs = new LinkedHashSet<>();
tbs.add(new TestBean("tb1"));
tbs.add(new TestBean("tb2"));
return tbs;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,7 +79,7 @@ public final class CustomEditorConfigurerTests {
public void testCustomEditorConfigurerWithEditorAsClass() throws ParseException {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CustomEditorConfigurer cec = new CustomEditorConfigurer();
Map<Class<?>, Class<? extends PropertyEditor>> editors = new HashMap<Class<?>, Class<? extends PropertyEditor>>();
Map<Class<?>, Class<? extends PropertyEditor>> editors = new HashMap<>();
editors.put(Date.class, MyDateEditor.class);
cec.setCustomEditors(editors);
cec.postProcessBeanFactory(bf);
@@ -99,7 +99,7 @@ public final class CustomEditorConfigurerTests {
public void testCustomEditorConfigurerWithRequiredTypeArray() throws ParseException {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
CustomEditorConfigurer cec = new CustomEditorConfigurer();
Map<Class<?>, Class<? extends PropertyEditor>> editors = new HashMap<Class<?>, Class<? extends PropertyEditor>>();
Map<Class<?>, Class<? extends PropertyEditor>> editors = new HashMap<>();
editors.put(String[].class, MyTestEditor.class);
cec.setCustomEditors(editors);
cec.postProcessBeanFactory(bf);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@ public final class CustomScopeConfigurerTests {
public void testSunnyDayWithBonaFideScopeInstance() throws Exception {
Scope scope = mock(Scope.class);
factory.registerScope(FOO_SCOPE, scope);
Map<String, Object> scopes = new HashMap<String, Object>();
Map<String, Object> scopes = new HashMap<>();
scopes.put(FOO_SCOPE, scope);
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.setScopes(scopes);
@@ -63,7 +63,7 @@ public final class CustomScopeConfigurerTests {
@Test
public void testSunnyDayWithBonaFideScopeClass() throws Exception {
Map<String, Object> scopes = new HashMap<String, Object>();
Map<String, Object> scopes = new HashMap<>();
scopes.put(FOO_SCOPE, NoOpScope.class);
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.setScopes(scopes);
@@ -73,7 +73,7 @@ public final class CustomScopeConfigurerTests {
@Test
public void testSunnyDayWithBonaFideScopeClassname() throws Exception {
Map<String, Object> scopes = new HashMap<String, Object>();
Map<String, Object> scopes = new HashMap<>();
scopes.put(FOO_SCOPE, NoOpScope.class.getName());
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.setScopes(scopes);
@@ -83,7 +83,7 @@ public final class CustomScopeConfigurerTests {
@Test(expected=IllegalArgumentException.class)
public void testWhereScopeMapHasNullScopeValueInEntrySet() throws Exception {
Map<String, Object> scopes = new HashMap<String, Object>();
Map<String, Object> scopes = new HashMap<>();
scopes.put(FOO_SCOPE, null);
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.setScopes(scopes);
@@ -92,7 +92,7 @@ public final class CustomScopeConfigurerTests {
@Test(expected=IllegalArgumentException.class)
public void testWhereScopeMapHasNonScopeInstanceInEntrySet() throws Exception {
Map<String, Object> scopes = new HashMap<String, Object>();
Map<String, Object> scopes = new HashMap<>();
scopes.put(FOO_SCOPE, this); // <-- not a valid value...
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.setScopes(scopes);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -148,7 +148,7 @@ public class MethodInvokingFactoryBeanTests {
mcfb = new MethodInvokingFactoryBean();
mcfb.setTargetClass(TestClass1.class);
mcfb.setTargetMethod("supertypes");
mcfb.setArguments(new Object[] {new ArrayList<Object>(), new ArrayList<Object>(), "hello"});
mcfb.setArguments(new Object[] {new ArrayList<>(), new ArrayList<Object>(), "hello"});
mcfb.afterPropertiesSet();
mcfb.getObjectType();
@@ -225,7 +225,7 @@ public class MethodInvokingFactoryBeanTests {
mcfb = new MethodInvokingFactoryBean();
mcfb.setTargetClass(TestClass1.class);
mcfb.setTargetMethod("supertypes");
mcfb.setArguments(new Object[] {new ArrayList<Object>(), new ArrayList<Object>(), "hello"});
mcfb.setArguments(new Object[] {new ArrayList<>(), new ArrayList<Object>(), "hello"});
// should pass
mcfb.afterPropertiesSet();
}
@@ -235,7 +235,7 @@ public class MethodInvokingFactoryBeanTests {
MethodInvokingFactoryBean mcfb = new MethodInvokingFactoryBean();
mcfb.setTargetClass(TestClass1.class);
mcfb.setTargetMethod("supertypes");
mcfb.setArguments(new Object[] {new ArrayList<Object>(), new ArrayList<Object>(), "hello", "bogus"});
mcfb.setArguments(new Object[] {new ArrayList<>(), new ArrayList<Object>(), "hello", "bogus"});
try {
mcfb.afterPropertiesSet();
fail("Matched method with wrong number of args");
@@ -260,14 +260,14 @@ public class MethodInvokingFactoryBeanTests {
mcfb = new MethodInvokingFactoryBean();
mcfb.setTargetClass(TestClass1.class);
mcfb.setTargetMethod("supertypes2");
mcfb.setArguments(new Object[] {new ArrayList<Object>(), new ArrayList<Object>(), "hello", "bogus"});
mcfb.setArguments(new Object[] {new ArrayList<>(), new ArrayList<Object>(), "hello", "bogus"});
mcfb.afterPropertiesSet();
assertEquals("hello", mcfb.getObject());
mcfb = new MethodInvokingFactoryBean();
mcfb.setTargetClass(TestClass1.class);
mcfb.setTargetMethod("supertypes2");
mcfb.setArguments(new Object[] {new ArrayList<Object>(), new ArrayList<Object>(), new Object()});
mcfb.setArguments(new Object[] {new ArrayList<>(), new ArrayList<Object>(), new Object()});
try {
mcfb.afterPropertiesSet();
fail("Matched method when shouldn't have matched");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -354,18 +354,18 @@ public class PropertyResourceConfigurerTests {
MutablePropertyValues pvs = new MutablePropertyValues();
pvs.add("stringArray", new String[] {"${os.name}", "${age}"});
List<Object> friends = new ManagedList<Object>();
List<Object> friends = new ManagedList<>();
friends.add("na${age}me");
friends.add(new RuntimeBeanReference("${ref}"));
pvs.add("friends", friends);
Set<Object> someSet = new ManagedSet<Object>();
Set<Object> someSet = new ManagedSet<>();
someSet.add("na${age}me");
someSet.add(new RuntimeBeanReference("${ref}"));
someSet.add(new TypedStringValue("${age}", Integer.class));
pvs.add("someSet", someSet);
Map<Object, Object> someMap = new ManagedMap<Object, Object>();
Map<Object, Object> someMap = new ManagedMap<>();
someMap.put(new TypedStringValue("key${age}"), new TypedStringValue("${age}"));
someMap.put(new TypedStringValue("key${age}ref"), new RuntimeBeanReference("${ref}"));
someMap.put("key1", new RuntimeBeanReference("${ref}"));
@@ -805,9 +805,9 @@ public class PropertyResourceConfigurerTests {
*/
public static class MockPreferences extends AbstractPreferences {
private static Map<String, String> values = new HashMap<String, String>();
private static Map<String, String> values = new HashMap<>();
private static Map<String, AbstractPreferences> children = new HashMap<String, AbstractPreferences>();
private static Map<String, AbstractPreferences> children = new HashMap<>();
public MockPreferences() {
super(null, "");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,7 +49,7 @@ public final class SimpleScopeTests {
beanFactory = new DefaultListableBeanFactory();
Scope scope = new NoOpScope() {
private int index;
private List<TestBean> objects = new LinkedList<TestBean>(); {
private List<TestBean> objects = new LinkedList<>(); {
objects.add(new TestBean());
objects.add(new TestBean());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,9 +66,9 @@ public final class CustomProblemReporterTests {
private static class CollatingProblemReporter implements ProblemReporter {
private List<Problem> errors = new ArrayList<Problem>();
private List<Problem> errors = new ArrayList<>();
private List<Problem> warnings = new ArrayList<Problem>();
private List<Problem> warnings = new ArrayList<>();
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,7 +83,7 @@ public class AutowireUtilsTests {
// Ideally we would expect Boolean.class instead of Object.class, but this
// information is not available at run-time due to type erasure.
Map<Integer, Boolean> map = new HashMap<Integer, Boolean>();
Map<Integer, Boolean> map = new HashMap<>();
map.put(0, false);
map.put(1, true);
Method extractMagicValue = ReflectionUtils.findMethod(MyTypeWithMethods.class, "extractMagicValue", new Class[] { Map.class });

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,7 +65,7 @@ public class BeanFactoryGenericsTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
Set<String> input = new HashSet<String>();
Set<String> input = new HashSet<>();
input.add("4");
input.add("5");
rbd.getPropertyValues().add("integerSet", input);
@@ -82,7 +82,7 @@ public class BeanFactoryGenericsTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
List<String> input = new ArrayList<String>();
List<String> input = new ArrayList<>();
input.add("http://localhost:8080");
input.add("http://localhost:9090");
rbd.getPropertyValues().add("resourceList", input);
@@ -114,7 +114,7 @@ public class BeanFactoryGenericsTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition rbd = new RootBeanDefinition(GenericIntegerBean.class);
List<Integer> input = new ArrayList<Integer>();
List<Integer> input = new ArrayList<>();
input.add(1);
rbd.getPropertyValues().add("testBeanList", input);
@@ -146,7 +146,7 @@ public class BeanFactoryGenericsTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
Map<String, String> input = new HashMap<String, String>();
Map<String, String> input = new HashMap<>();
input.put("4", "5");
input.put("6", "7");
rbd.getPropertyValues().add("shortMap", input);
@@ -178,7 +178,7 @@ public class BeanFactoryGenericsTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
Set<String> input = new HashSet<String>();
Set<String> input = new HashSet<>();
input.add("4");
input.add("5");
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -222,10 +222,10 @@ public class BeanFactoryGenericsTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
Set<String> input = new HashSet<String>();
Set<String> input = new HashSet<>();
input.add("4");
input.add("5");
List<String> input2 = new ArrayList<String>();
List<String> input2 = new ArrayList<>();
input2.add("http://localhost:8080");
input2.add("http://localhost:9090");
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -279,10 +279,10 @@ public class BeanFactoryGenericsTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
Set<String> input = new HashSet<String>();
Set<String> input = new HashSet<>();
input.add("4");
input.add("5");
Map<String, String> input2 = new HashMap<String, String>();
Map<String, String> input2 = new HashMap<>();
input2.put("4", "5");
input2.put("6", "7");
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -302,7 +302,7 @@ public class BeanFactoryGenericsTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
Map<String, String> input = new HashMap<String, String>();
Map<String, String> input = new HashMap<>();
input.put("4", "5");
input.put("6", "7");
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -321,10 +321,10 @@ public class BeanFactoryGenericsTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
Map<String, String> input = new HashMap<String, String>();
Map<String, String> input = new HashMap<>();
input.put("1", "0");
input.put("2", "3");
Map<String, String> input2 = new HashMap<String, String>();
Map<String, String> input2 = new HashMap<>();
input2.put("4", "5");
input2.put("6", "7");
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -347,7 +347,7 @@ public class BeanFactoryGenericsTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
Map<String, String> input = new HashMap<String, String>();
Map<String, String> input = new HashMap<>();
input.put("1", "0");
input.put("2", "3");
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -370,7 +370,7 @@ public class BeanFactoryGenericsTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
Map<Short, Integer> input = new HashMap<Short, Integer>();
Map<Short, Integer> input = new HashMap<>();
input.put(new Short((short) 1), new Integer(0));
input.put(new Short((short) 2), new Integer(3));
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -390,7 +390,7 @@ public class BeanFactoryGenericsTests {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
Map<String, String> input = new HashMap<String, String>();
Map<String, String> input = new HashMap<>();
input.put("4", "5");
input.put("6", "7");
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -413,11 +413,11 @@ public class BeanFactoryGenericsTests {
});
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
Map<String, AbstractCollection<?>> input = new HashMap<String, AbstractCollection<?>>();
HashSet<Integer> value1 = new HashSet<Integer>();
Map<String, AbstractCollection<?>> input = new HashMap<>();
HashSet<Integer> value1 = new HashSet<>();
value1.add(new Integer(1));
input.put("1", value1);
ArrayList<Boolean> value2 = new ArrayList<Boolean>();
ArrayList<Boolean> value2 = new ArrayList<>();
value2.add(Boolean.TRUE);
input.put("2", value2);
rbd.getConstructorArgumentValues().addGenericArgumentValue(Boolean.TRUE);
@@ -437,7 +437,7 @@ public class BeanFactoryGenericsTests {
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
rbd.setFactoryMethodName("createInstance");
Set<String> input = new HashSet<String>();
Set<String> input = new HashSet<>();
input.add("4");
input.add("5");
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -455,10 +455,10 @@ public class BeanFactoryGenericsTests {
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
rbd.setFactoryMethodName("createInstance");
Set<String> input = new HashSet<String>();
Set<String> input = new HashSet<>();
input.add("4");
input.add("5");
List<String> input2 = new ArrayList<String>();
List<String> input2 = new ArrayList<>();
input2.add("http://localhost:8080");
input2.add("http://localhost:9090");
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -479,10 +479,10 @@ public class BeanFactoryGenericsTests {
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
rbd.setFactoryMethodName("createInstance");
Set<String> input = new HashSet<String>();
Set<String> input = new HashSet<>();
input.add("4");
input.add("5");
Map<String, String> input2 = new HashMap<String, String>();
Map<String, String> input2 = new HashMap<>();
input2.put("4", "5");
input2.put("6", "7");
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -503,7 +503,7 @@ public class BeanFactoryGenericsTests {
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
rbd.setFactoryMethodName("createInstance");
Map<String, String> input = new HashMap<String, String>();
Map<String, String> input = new HashMap<>();
input.put("4", "5");
input.put("6", "7");
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -523,10 +523,10 @@ public class BeanFactoryGenericsTests {
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
rbd.setFactoryMethodName("createInstance");
Map<String, String> input = new HashMap<String, String>();
Map<String, String> input = new HashMap<>();
input.put("1", "0");
input.put("2", "3");
Map<String, String> input2 = new HashMap<String, String>();
Map<String, String> input2 = new HashMap<>();
input2.put("4", "5");
input2.put("6", "7");
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -547,7 +547,7 @@ public class BeanFactoryGenericsTests {
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
rbd.setFactoryMethodName("createInstance");
Map<String, String> input = new HashMap<String, String>();
Map<String, String> input = new HashMap<>();
input.put("4", "5");
input.put("6", "7");
rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
@@ -571,11 +571,11 @@ public class BeanFactoryGenericsTests {
RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
rbd.setFactoryMethodName("createInstance");
Map<String, AbstractCollection<?>> input = new HashMap<String, AbstractCollection<?>>();
HashSet<Integer> value1 = new HashSet<Integer>();
Map<String, AbstractCollection<?>> input = new HashMap<>();
HashSet<Integer> value1 = new HashSet<>();
value1.add(new Integer(1));
input.put("1", value1);
ArrayList<Boolean> value2 = new ArrayList<Boolean>();
ArrayList<Boolean> value2 = new ArrayList<>();
value2.add(Boolean.TRUE);
input.put("2", value2);
rbd.getConstructorArgumentValues().addGenericArgumentValue(Boolean.TRUE);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1362,7 +1362,7 @@ public class CustomEditorTests {
bw.registerCustomEditor(List.class, "list", new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
List<TestBean> result = new ArrayList<TestBean>();
List<TestBean> result = new ArrayList<>();
result.add(new TestBean("list" + text, 99));
setValue(result);
}
@@ -1397,7 +1397,7 @@ public class CustomEditorTests {
PropertyEditor pe = new CustomNumberEditor(Integer.class, true);
bw.registerCustomEditor(null, "list.age", pe);
TestBean tb = new TestBean();
bw.setPropertyValue("list", new ArrayList<Object>());
bw.setPropertyValue("list", new ArrayList<>());
bw.setPropertyValue("list[0]", tb);
assertEquals(tb, bean.getList().get(0));
assertEquals(pe, bw.findCustomEditor(int.class, "list.age"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ public class PropertyComparatorTests {
@SuppressWarnings("unchecked")
@Test
public void testCompoundComparator() {
CompoundComparator<Dog> c = new CompoundComparator<Dog>();
CompoundComparator<Dog> c = new CompoundComparator<>();
c.addComparator(new PropertyComparator("lastName", false, true));
Dog dog1 = new Dog();
@@ -80,7 +80,7 @@ public class PropertyComparatorTests {
@SuppressWarnings("unchecked")
@Test
public void testCompoundComparatorInvert() {
CompoundComparator<Dog> c = new CompoundComparator<Dog>();
CompoundComparator<Dog> c = new CompoundComparator<>();
c.addComparator(new PropertyComparator("lastName", false, true));
c.addComparator(new PropertyComparator("firstName", false, true));
Dog dog1 = new Dog();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -267,7 +267,7 @@ public class GenericBean<T> {
}
public void setCustomEnumSetMismatch(Set<String> customEnumSet) {
this.customEnumSet = new HashSet<CustomEnum>(customEnumSet.size());
this.customEnumSet = new HashSet<>(customEnumSet.size());
for (Iterator<String> iterator = customEnumSet.iterator(); iterator.hasNext(); ) {
this.customEnumSet.add(CustomEnum.valueOf(iterator.next()));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -69,13 +69,13 @@ public class IndexedTestBean {
TestBean tbX = new TestBean("nameX", 0);
TestBean tbY = new TestBean("nameY", 0);
this.array = new TestBean[] {tb0, tb1};
this.list = new ArrayList<Object>();
this.list = new ArrayList<>();
this.list.add(tb2);
this.list.add(tb3);
this.set = new TreeSet<Object>();
this.set = new TreeSet<>();
this.set.add(tb6);
this.set.add(tb7);
this.map = new HashMap<Object, Object>();
this.map = new HashMap<>();
this.map.put("key1", tb4);
this.map.put("key2", tb5);
this.map.put("key.3", tb5);