Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -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.
|
||||
@@ -461,7 +461,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||
}
|
||||
|
||||
private void bindExplicitArguments(int numArgumentsLeftToBind) {
|
||||
this.argumentBindings = new HashMap<String, Integer>();
|
||||
this.argumentBindings = new HashMap<>();
|
||||
|
||||
int numExpectedArgumentNames = this.aspectJAdviceMethod.getParameterTypes().length;
|
||||
if (this.argumentNames.length != numExpectedArgumentNames) {
|
||||
|
||||
@@ -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.
|
||||
@@ -130,8 +130,8 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
||||
private static final int STEP_REFERENCE_PCUT_BINDING = 7;
|
||||
private static final int STEP_FINISHED = 8;
|
||||
|
||||
private static final Set<String> singleValuedAnnotationPcds = new HashSet<String>();
|
||||
private static final Set<String> nonReferencePointcutTokens = new HashSet<String>();
|
||||
private static final Set<String> singleValuedAnnotationPcds = new HashSet<>();
|
||||
private static final Set<String> nonReferencePointcutTokens = new HashSet<>();
|
||||
|
||||
|
||||
static {
|
||||
@@ -414,7 +414,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
||||
* <p>Some more support from AspectJ in doing this exercise would be nice... :)
|
||||
*/
|
||||
private void maybeBindAnnotationsFromPointcutExpression() {
|
||||
List<String> varNames = new ArrayList<String>();
|
||||
List<String> varNames = new ArrayList<>();
|
||||
String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
String toMatch = tokens[i];
|
||||
@@ -520,7 +520,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
||||
+ " unbound args at this(),target(),args() binding stage, with no way to determine between them");
|
||||
}
|
||||
|
||||
List<String> varNames = new ArrayList<String>();
|
||||
List<String> varNames = new ArrayList<>();
|
||||
String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
if (tokens[i].equals("this") ||
|
||||
@@ -537,7 +537,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
||||
else if (tokens[i].equals("args") || tokens[i].startsWith("args(")) {
|
||||
PointcutBody body = getPointcutBody(tokens, i);
|
||||
i += body.numTokensConsumed;
|
||||
List<String> candidateVarNames = new ArrayList<String>();
|
||||
List<String> candidateVarNames = new ArrayList<>();
|
||||
maybeExtractVariableNamesFromArgs(body.text, candidateVarNames);
|
||||
// we may have found some var names that were bound in previous primitive args binding step,
|
||||
// filter them out...
|
||||
@@ -571,7 +571,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
||||
+ " unbound args at reference pointcut binding stage, with no way to determine between them");
|
||||
}
|
||||
|
||||
List<String> varNames = new ArrayList<String>();
|
||||
List<String> varNames = new ArrayList<>();
|
||||
String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
String toMatch = tokens[i];
|
||||
@@ -683,7 +683,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
||||
}
|
||||
if (numUnboundPrimitives == 1) {
|
||||
// Look for arg variable and bind it if we find exactly one...
|
||||
List<String> varNames = new ArrayList<String>();
|
||||
List<String> varNames = new ArrayList<>();
|
||||
String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
if (tokens[i].equals("args") || tokens[i].startsWith("args(")) {
|
||||
|
||||
@@ -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.
|
||||
@@ -82,7 +82,7 @@ import org.springframework.util.StringUtils;
|
||||
public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
||||
implements ClassFilter, IntroductionAwareMethodMatcher, BeanFactoryAware {
|
||||
|
||||
private static final Set<PointcutPrimitive> SUPPORTED_PRIMITIVES = new HashSet<PointcutPrimitive>();
|
||||
private static final Set<PointcutPrimitive> SUPPORTED_PRIMITIVES = new HashSet<>();
|
||||
|
||||
static {
|
||||
SUPPORTED_PRIMITIVES.add(PointcutPrimitive.EXECUTION);
|
||||
@@ -112,7 +112,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
||||
|
||||
private transient PointcutExpression pointcutExpression;
|
||||
|
||||
private transient Map<Method, ShadowMatch> shadowMatchCache = new ConcurrentHashMap<Method, ShadowMatch>(32);
|
||||
private transient Map<Method, ShadowMatch> shadowMatchCache = new ConcurrentHashMap<>(32);
|
||||
|
||||
|
||||
/**
|
||||
@@ -628,7 +628,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
||||
|
||||
// Initialize transient fields.
|
||||
// pointcutExpression will be initialized lazily by checkReadyToMatch()
|
||||
this.shadowMatchCache = new ConcurrentHashMap<Method, ShadowMatch>(32);
|
||||
this.shadowMatchCache = new ConcurrentHashMap<>(32);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -184,7 +184,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
||||
private static <A extends Annotation> AspectJAnnotation<A> findAnnotation(Method method, Class<A> toLookFor) {
|
||||
A result = AnnotationUtils.findAnnotation(method, toLookFor);
|
||||
if (result != null) {
|
||||
return new AspectJAnnotation<A>(result);
|
||||
return new AspectJAnnotation<>(result);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
@@ -212,7 +212,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
||||
private static final String[] EXPRESSION_PROPERTIES = new String[] {"value", "pointcut"};
|
||||
|
||||
private static Map<Class<?>, AspectJAnnotationType> annotationTypes =
|
||||
new HashMap<Class<?>, AspectJAnnotationType>();
|
||||
new HashMap<>();
|
||||
|
||||
static {
|
||||
annotationTypes.put(Pointcut.class,AspectJAnnotationType.AtPointcut);
|
||||
|
||||
@@ -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.
|
||||
@@ -60,7 +60,7 @@ public class AnnotationAwareAspectJAutoProxyCreator extends AspectJAwareAdvisorA
|
||||
* <p>Default is to consider all @AspectJ beans as eligible.
|
||||
*/
|
||||
public void setIncludePatterns(List<String> patterns) {
|
||||
this.includePatterns = new ArrayList<Pattern>(patterns.size());
|
||||
this.includePatterns = new ArrayList<>(patterns.size());
|
||||
for (String patternText : patterns) {
|
||||
this.includePatterns.add(Pattern.compile(patternText));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -50,7 +50,7 @@ import org.springframework.util.ClassUtils;
|
||||
public class AspectJProxyFactory extends ProxyCreatorSupport {
|
||||
|
||||
/** Cache for singleton aspect instances */
|
||||
private static final Map<Class<?>, Object> aspectCache = new HashMap<Class<?>, Object>();
|
||||
private static final Map<Class<?>, Object> aspectCache = new HashMap<>();
|
||||
|
||||
private final AspectJAdvisorFactory aspectFactory = new ReflectiveAspectJAdvisorFactory();
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -45,10 +45,10 @@ public class BeanFactoryAspectJAdvisorsBuilder {
|
||||
|
||||
private List<String> aspectBeanNames;
|
||||
|
||||
private final Map<String, List<Advisor>> advisorsCache = new HashMap<String, List<Advisor>>();
|
||||
private final Map<String, List<Advisor>> advisorsCache = new HashMap<>();
|
||||
|
||||
private final Map<String, MetadataAwareAspectInstanceFactory> aspectFactoryCache =
|
||||
new HashMap<String, MetadataAwareAspectInstanceFactory>();
|
||||
new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -85,8 +85,8 @@ public class BeanFactoryAspectJAdvisorsBuilder {
|
||||
synchronized (this) {
|
||||
aspectNames = this.aspectBeanNames;
|
||||
if (aspectNames == null) {
|
||||
List<Advisor> advisors = new LinkedList<Advisor>();
|
||||
aspectNames = new LinkedList<String>();
|
||||
List<Advisor> advisors = new LinkedList<>();
|
||||
aspectNames = new LinkedList<>();
|
||||
String[] beanNames =
|
||||
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.beanFactory, Object.class, true, false);
|
||||
for (String beanName : beanNames) {
|
||||
@@ -136,7 +136,7 @@ public class BeanFactoryAspectJAdvisorsBuilder {
|
||||
if (aspectNames.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<Advisor> advisors = new LinkedList<Advisor>();
|
||||
List<Advisor> advisors = new LinkedList<>();
|
||||
for (String aspectName : aspectNames) {
|
||||
List<Advisor> cachedAdvisors = this.advisorsCache.get(aspectName);
|
||||
if (cachedAdvisors != null) {
|
||||
|
||||
@@ -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.
|
||||
@@ -72,9 +72,9 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
||||
private static final Comparator<Method> METHOD_COMPARATOR;
|
||||
|
||||
static {
|
||||
CompoundComparator<Method> comparator = new CompoundComparator<Method>();
|
||||
comparator.addComparator(new ConvertingComparator<Method, Annotation>(
|
||||
new InstanceComparator<Annotation>(
|
||||
CompoundComparator<Method> comparator = new CompoundComparator<>();
|
||||
comparator.addComparator(new ConvertingComparator<>(
|
||||
new InstanceComparator<>(
|
||||
Around.class, Before.class, After.class, AfterReturning.class, AfterThrowing.class),
|
||||
new Converter<Method, Annotation>() {
|
||||
@Override
|
||||
@@ -84,7 +84,7 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
||||
return (annotation != null ? annotation.getAnnotation() : null);
|
||||
}
|
||||
}));
|
||||
comparator.addComparator(new ConvertingComparator<Method, String>(
|
||||
comparator.addComparator(new ConvertingComparator<>(
|
||||
new Converter<Method, String>() {
|
||||
@Override
|
||||
public String convert(Method method) {
|
||||
@@ -106,7 +106,7 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
||||
MetadataAwareAspectInstanceFactory lazySingletonAspectInstanceFactory =
|
||||
new LazySingletonAspectInstanceFactoryDecorator(aspectInstanceFactory);
|
||||
|
||||
List<Advisor> advisors = new LinkedList<Advisor>();
|
||||
List<Advisor> advisors = new LinkedList<>();
|
||||
for (Method method : getAdvisorMethods(aspectClass)) {
|
||||
Advisor advisor = getAdvisor(method, lazySingletonAspectInstanceFactory, advisors.size(), aspectName);
|
||||
if (advisor != null) {
|
||||
@@ -132,7 +132,7 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
||||
}
|
||||
|
||||
private List<Method> getAdvisorMethods(Class<?> aspectClass) {
|
||||
final List<Method> methods = new LinkedList<Method>();
|
||||
final List<Method> methods = new LinkedList<>();
|
||||
ReflectionUtils.doWithMethods(aspectClass, new ReflectionUtils.MethodCallback() {
|
||||
@Override
|
||||
public void doWith(Method method) throws IllegalArgumentException {
|
||||
|
||||
@@ -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.
|
||||
@@ -68,7 +68,7 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
|
||||
@SuppressWarnings("unchecked")
|
||||
protected List<Advisor> sortAdvisors(List<Advisor> advisors) {
|
||||
List<PartiallyComparableAdvisorHolder> partiallyComparableAdvisors =
|
||||
new ArrayList<PartiallyComparableAdvisorHolder>(advisors.size());
|
||||
new ArrayList<>(advisors.size());
|
||||
for (Advisor element : advisors) {
|
||||
partiallyComparableAdvisors.add(
|
||||
new PartiallyComparableAdvisorHolder(element, DEFAULT_PRECEDENCE_COMPARATOR));
|
||||
@@ -76,7 +76,7 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
|
||||
List<PartiallyComparableAdvisorHolder> sorted =
|
||||
PartialOrder.sort(partiallyComparableAdvisors);
|
||||
if (sorted != null) {
|
||||
List<Advisor> result = new ArrayList<Advisor>(advisors.size());
|
||||
List<Advisor> result = new ArrayList<>(advisors.size());
|
||||
for (PartiallyComparableAdvisorHolder pcAdvisor : sorted) {
|
||||
result.add(pcAdvisor.getAdvisor());
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public abstract class AopConfigUtils {
|
||||
/**
|
||||
* Stores the auto proxy creator classes in escalation order.
|
||||
*/
|
||||
private static final List<Class<?>> APC_PRIORITY_LIST = new ArrayList<Class<?>>();
|
||||
private static final List<Class<?>> APC_PRIORITY_LIST = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Setup the escalation list.
|
||||
|
||||
@@ -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.
|
||||
@@ -53,7 +53,7 @@ class AspectJAutoProxyBeanDefinitionParser implements BeanDefinitionParser {
|
||||
}
|
||||
|
||||
private void addIncludePatterns(Element element, ParserContext parserContext, BeanDefinition beanDef) {
|
||||
ManagedList<TypedStringValue> includePatterns = new ManagedList<TypedStringValue>();
|
||||
ManagedList<TypedStringValue> includePatterns = new ManagedList<>();
|
||||
NodeList childNodes = element.getChildNodes();
|
||||
for (int i = 0; i < childNodes.getLength(); i++) {
|
||||
Node node = childNodes.item(i);
|
||||
|
||||
@@ -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.
|
||||
@@ -199,8 +199,8 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
try {
|
||||
this.parseState.push(new AspectEntry(aspectId, aspectName));
|
||||
List<BeanDefinition> beanDefinitions = new ArrayList<BeanDefinition>();
|
||||
List<BeanReference> beanReferences = new ArrayList<BeanReference>();
|
||||
List<BeanDefinition> beanDefinitions = new ArrayList<>();
|
||||
List<BeanReference> beanReferences = new ArrayList<>();
|
||||
|
||||
List<Element> declareParents = DomUtils.getChildElementsByTagName(aspectElement, DECLARE_PARENTS);
|
||||
for (int i = METHOD_INDEX; i < declareParents.size(); i++) {
|
||||
|
||||
@@ -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.
|
||||
@@ -37,7 +37,7 @@ public abstract class AbstractAdvisingBeanPostProcessor extends ProxyProcessorSu
|
||||
|
||||
protected boolean beforeExistingAdvisors = false;
|
||||
|
||||
private final Map<Class<?>, Boolean> eligibleBeans = new ConcurrentHashMap<Class<?>, Boolean>(256);
|
||||
private final Map<Class<?>, Boolean> eligibleBeans = new ConcurrentHashMap<>(256);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -87,13 +87,13 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
||||
* Interfaces to be implemented by the proxy. Held in List to keep the order
|
||||
* of registration, to create JDK proxy with specified order of interfaces.
|
||||
*/
|
||||
private List<Class<?>> interfaces = new ArrayList<Class<?>>();
|
||||
private List<Class<?>> interfaces = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* List of Advisors. If an Advice is added, it will be wrapped
|
||||
* in an Advisor before being added to this List.
|
||||
*/
|
||||
private List<Advisor> advisors = new LinkedList<Advisor>();
|
||||
private List<Advisor> advisors = new LinkedList<>();
|
||||
|
||||
/**
|
||||
* Array updated on changes to the advisors list, which is easier
|
||||
@@ -122,7 +122,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
||||
* Initialize the method cache.
|
||||
*/
|
||||
private void initMethodCache() {
|
||||
this.methodCache = new ConcurrentHashMap<MethodCacheKey, List<Object>>(32);
|
||||
this.methodCache = new ConcurrentHashMap<>(32);
|
||||
}
|
||||
|
||||
|
||||
@@ -506,7 +506,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
||||
* @param other the AdvisedSupport object to copy configuration from
|
||||
*/
|
||||
protected void copyConfigurationFrom(AdvisedSupport other) {
|
||||
copyConfigurationFrom(other, other.targetSource, new ArrayList<Advisor>(other.advisors));
|
||||
copyConfigurationFrom(other, other.targetSource, new ArrayList<>(other.advisors));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -520,7 +520,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
||||
copyFrom(other);
|
||||
this.targetSource = targetSource;
|
||||
this.advisorChainFactory = other.advisorChainFactory;
|
||||
this.interfaces = new ArrayList<Class<?>>(other.interfaces);
|
||||
this.interfaces = new ArrayList<>(other.interfaces);
|
||||
for (Advisor advisor : advisors) {
|
||||
if (advisor instanceof IntroductionAdvisor) {
|
||||
validateIntroductionAdvisor((IntroductionAdvisor) advisor);
|
||||
|
||||
@@ -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.
|
||||
@@ -46,7 +46,7 @@ public abstract class AopContext {
|
||||
* the controlling proxy configuration has been set to "true".
|
||||
* @see ProxyConfig#setExposeProxy
|
||||
*/
|
||||
private static final ThreadLocal<Object> currentProxy = new NamedThreadLocal<Object>("Current AOP proxy");
|
||||
private static final ThreadLocal<Object> currentProxy = new NamedThreadLocal<>("Current AOP proxy");
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -97,7 +97,7 @@ class CglibAopProxy implements AopProxy, Serializable {
|
||||
protected static final Log logger = LogFactory.getLog(CglibAopProxy.class);
|
||||
|
||||
/** Keeps track of the Classes that we have validated for final methods */
|
||||
private static final Map<Class<?>, Boolean> validatedClasses = new WeakHashMap<Class<?>, Boolean>();
|
||||
private static final Map<Class<?>, Boolean> validatedClasses = new WeakHashMap<>();
|
||||
|
||||
|
||||
/** The configuration used to configure this proxy */
|
||||
@@ -322,7 +322,7 @@ class CglibAopProxy implements AopProxy, Serializable {
|
||||
if (isStatic && isFrozen) {
|
||||
Method[] methods = rootClass.getMethods();
|
||||
Callback[] fixedCallbacks = new Callback[methods.length];
|
||||
this.fixedInterceptorMap = new HashMap<String, Integer>(methods.length);
|
||||
this.fixedInterceptorMap = new HashMap<>(methods.length);
|
||||
|
||||
// TODO: small memory optimisation here (can skip creation for methods with no advice)
|
||||
for (int x = 0; x < methods.length; x++) {
|
||||
|
||||
@@ -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.
|
||||
@@ -52,7 +52,7 @@ public class DefaultAdvisorChainFactory implements AdvisorChainFactory, Serializ
|
||||
|
||||
// This is somewhat tricky... We have to process introductions first,
|
||||
// but we need to preserve order in the ultimate list.
|
||||
List<Object> interceptorList = new ArrayList<Object>(config.getAdvisors().length);
|
||||
List<Object> interceptorList = new ArrayList<>(config.getAdvisors().length);
|
||||
Class<?> actualClass = (targetClass != null ? targetClass : method.getDeclaringClass());
|
||||
boolean hasIntroductions = hasMatchingIntroductions(config, actualClass);
|
||||
AdvisorAdapterRegistry registry = GlobalAdvisorAdapterRegistry.getInstance();
|
||||
|
||||
@@ -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.
|
||||
@@ -34,7 +34,7 @@ public class ProxyCreatorSupport extends AdvisedSupport {
|
||||
|
||||
private AopProxyFactory aopProxyFactory;
|
||||
|
||||
private List<AdvisedSupportListener> listeners = new LinkedList<AdvisedSupportListener>();
|
||||
private List<AdvisedSupportListener> listeners = new LinkedList<>();
|
||||
|
||||
/** Set to true when the first AOP proxy has been created */
|
||||
private boolean active = false;
|
||||
|
||||
@@ -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.
|
||||
@@ -480,7 +480,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
||||
*/
|
||||
private List<Advisor> freshAdvisorChain() {
|
||||
Advisor[] advisors = getAdvisors();
|
||||
List<Advisor> freshAdvisors = new ArrayList<Advisor>(advisors.length);
|
||||
List<Advisor> freshAdvisors = new ArrayList<>(advisors.length);
|
||||
for (Advisor advisor : advisors) {
|
||||
if (advisor instanceof PrototypePlaceholderAdvisor) {
|
||||
PrototypePlaceholderAdvisor pa = (PrototypePlaceholderAdvisor) advisor;
|
||||
@@ -513,8 +513,8 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
||||
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(beanFactory, Advisor.class);
|
||||
String[] globalInterceptorNames =
|
||||
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(beanFactory, Interceptor.class);
|
||||
List<Object> beans = new ArrayList<Object>(globalAdvisorNames.length + globalInterceptorNames.length);
|
||||
Map<Object, String> names = new HashMap<Object, String>(beans.size());
|
||||
List<Object> beans = new ArrayList<>(globalAdvisorNames.length + globalInterceptorNames.length);
|
||||
Map<Object, String> names = new HashMap<>(beans.size());
|
||||
for (String name : globalAdvisorNames) {
|
||||
Object bean = beanFactory.getBean(name);
|
||||
beans.add(bean);
|
||||
|
||||
@@ -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.
|
||||
@@ -223,7 +223,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
||||
// Force initialization of the user attributes Map,
|
||||
// for having a shared Map reference in the clone.
|
||||
if (this.userAttributes == null) {
|
||||
this.userAttributes = new HashMap<String, Object>();
|
||||
this.userAttributes = new HashMap<>();
|
||||
}
|
||||
|
||||
// Create the MethodInvocation clone.
|
||||
@@ -243,7 +243,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
||||
public void setUserAttribute(String key, Object value) {
|
||||
if (value != null) {
|
||||
if (this.userAttributes == null) {
|
||||
this.userAttributes = new HashMap<String, Object>();
|
||||
this.userAttributes = new HashMap<>();
|
||||
}
|
||||
this.userAttributes.put(key, value);
|
||||
}
|
||||
@@ -268,7 +268,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
||||
*/
|
||||
public Map<String, Object> getUserAttributes() {
|
||||
if (this.userAttributes == null) {
|
||||
this.userAttributes = new HashMap<String, Object>();
|
||||
this.userAttributes = new HashMap<>();
|
||||
}
|
||||
return this.userAttributes;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -40,7 +40,7 @@ import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||
@SuppressWarnings("serial")
|
||||
public class DefaultAdvisorAdapterRegistry implements AdvisorAdapterRegistry, Serializable {
|
||||
|
||||
private final List<AdvisorAdapter> adapters = new ArrayList<AdvisorAdapter>(3);
|
||||
private final List<AdvisorAdapter> adapters = new ArrayList<>(3);
|
||||
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ public class DefaultAdvisorAdapterRegistry implements AdvisorAdapterRegistry, Se
|
||||
|
||||
@Override
|
||||
public MethodInterceptor[] getInterceptors(Advisor advisor) throws UnknownAdviceTypeException {
|
||||
List<MethodInterceptor> interceptors = new ArrayList<MethodInterceptor>(3);
|
||||
List<MethodInterceptor> interceptors = new ArrayList<>(3);
|
||||
Advice advice = advisor.getAdvice();
|
||||
if (advice instanceof MethodInterceptor) {
|
||||
interceptors.add((MethodInterceptor) advice);
|
||||
|
||||
@@ -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.
|
||||
@@ -61,7 +61,7 @@ public class ThrowsAdviceInterceptor implements MethodInterceptor, AfterAdvice {
|
||||
private final Object throwsAdvice;
|
||||
|
||||
/** Methods on throws advice, keyed by exception class */
|
||||
private final Map<Class<?>, Method> exceptionHandlerMap = new HashMap<Class<?>, Method>();
|
||||
private final Map<Class<?>, Method> exceptionHandlerMap = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -132,11 +132,11 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
||||
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(16));
|
||||
|
||||
private final Set<Object> earlyProxyReferences =
|
||||
Collections.newSetFromMap(new ConcurrentHashMap<Object, Boolean>(16));
|
||||
Collections.newSetFromMap(new ConcurrentHashMap<>(16));
|
||||
|
||||
private final Map<Object, Class<?>> proxyTypes = new ConcurrentHashMap<Object, Class<?>>(16);
|
||||
private final Map<Object, Class<?>> proxyTypes = new ConcurrentHashMap<>(16);
|
||||
|
||||
private final Map<Object, Boolean> advisedBeans = new ConcurrentHashMap<Object, Boolean>(256);
|
||||
private final Map<Object, Boolean> advisedBeans = new ConcurrentHashMap<>(256);
|
||||
|
||||
|
||||
/**
|
||||
@@ -510,7 +510,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
||||
// Handle prototypes correctly...
|
||||
Advisor[] commonInterceptors = resolveInterceptorNames();
|
||||
|
||||
List<Object> allInterceptors = new ArrayList<Object>();
|
||||
List<Object> allInterceptors = new ArrayList<>();
|
||||
if (specificInterceptors != null) {
|
||||
allInterceptors.addAll(Arrays.asList(specificInterceptors));
|
||||
if (commonInterceptors.length > 0) {
|
||||
@@ -543,7 +543,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
||||
private Advisor[] resolveInterceptorNames() {
|
||||
ConfigurableBeanFactory cbf = (this.beanFactory instanceof ConfigurableBeanFactory ?
|
||||
(ConfigurableBeanFactory) this.beanFactory : null);
|
||||
List<Advisor> advisors = new ArrayList<Advisor>();
|
||||
List<Advisor> advisors = new ArrayList<>();
|
||||
for (String beanName : this.interceptorNames) {
|
||||
if (cbf == null || !cbf.isCurrentlyInCreation(beanName)) {
|
||||
Object next = this.beanFactory.getBean(beanName);
|
||||
|
||||
@@ -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.
|
||||
@@ -76,10 +76,10 @@ public class BeanFactoryAdvisorRetrievalHelper {
|
||||
}
|
||||
}
|
||||
if (advisorNames.length == 0) {
|
||||
return new LinkedList<Advisor>();
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
List<Advisor> advisors = new LinkedList<Advisor>();
|
||||
List<Advisor> advisors = new LinkedList<>();
|
||||
for (String name : advisorNames) {
|
||||
if (isEligibleBean(name)) {
|
||||
if (this.beanFactory.isCurrentlyInCreation(name)) {
|
||||
|
||||
@@ -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.
|
||||
@@ -62,7 +62,7 @@ public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator {
|
||||
*/
|
||||
public void setBeanNames(String... beanNames) {
|
||||
Assert.notEmpty(beanNames, "'beanNames' must not be empty");
|
||||
this.beanNames = new ArrayList<String>(beanNames.length);
|
||||
this.beanNames = new ArrayList<>(beanNames.length);
|
||||
for (String mappedName : beanNames) {
|
||||
this.beanNames.add(StringUtils.trimWhitespace(mappedName));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -30,7 +30,7 @@ public class ProxyCreationContext {
|
||||
|
||||
/** ThreadLocal holding the current proxied bean name during Advisor matching */
|
||||
private static final ThreadLocal<String> currentProxiedBeanName =
|
||||
new NamedThreadLocal<String>("Name of currently proxied bean");
|
||||
new NamedThreadLocal<>("Name of currently proxied bean");
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -63,7 +63,7 @@ public abstract class AbstractBeanFactoryBasedTargetSourceCreator
|
||||
|
||||
/** Internally used DefaultListableBeanFactory instances, keyed by bean name */
|
||||
private final Map<String, DefaultListableBeanFactory> internalBeanFactories =
|
||||
new HashMap<String, DefaultListableBeanFactory>();
|
||||
new HashMap<>();
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -70,7 +70,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final Map<Method, AsyncTaskExecutor> executors = new ConcurrentHashMap<Method, AsyncTaskExecutor>(16);
|
||||
private final Map<Method, AsyncTaskExecutor> executors = new ConcurrentHashMap<>(16);
|
||||
|
||||
private volatile Executor defaultExecutor;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -58,7 +58,7 @@ public class ExposeInvocationInterceptor implements MethodInterceptor, PriorityO
|
||||
};
|
||||
|
||||
private static final ThreadLocal<MethodInvocation> invocation =
|
||||
new NamedThreadLocal<MethodInvocation>("Current AOP method invocation");
|
||||
new NamedThreadLocal<>("Current AOP method invocation");
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -232,7 +232,7 @@ public abstract class AopUtils {
|
||||
introductionAwareMethodMatcher = (IntroductionAwareMethodMatcher) methodMatcher;
|
||||
}
|
||||
|
||||
Set<Class<?>> classes = new LinkedHashSet<Class<?>>(ClassUtils.getAllInterfacesForClassAsSet(targetClass));
|
||||
Set<Class<?>> classes = new LinkedHashSet<>(ClassUtils.getAllInterfacesForClassAsSet(targetClass));
|
||||
classes.add(targetClass);
|
||||
for (Class<?> clazz : classes) {
|
||||
Method[] methods = ReflectionUtils.getAllDeclaredMethods(clazz);
|
||||
@@ -296,7 +296,7 @@ public abstract class AopUtils {
|
||||
if (candidateAdvisors.isEmpty()) {
|
||||
return candidateAdvisors;
|
||||
}
|
||||
List<Advisor> eligibleAdvisors = new LinkedList<Advisor>();
|
||||
List<Advisor> eligibleAdvisors = new LinkedList<>();
|
||||
for (Advisor candidate : candidateAdvisors) {
|
||||
if (candidate instanceof IntroductionAdvisor && canApply(candidate, clazz)) {
|
||||
eligibleAdvisors.add(candidate);
|
||||
|
||||
@@ -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 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
|
||||
|
||||
private final Advice advice;
|
||||
|
||||
private final Set<Class<?>> interfaces = new LinkedHashSet<Class<?>>();
|
||||
private final Set<Class<?>> interfaces = new LinkedHashSet<>();
|
||||
|
||||
private int order = Integer.MAX_VALUE;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -57,7 +57,7 @@ public class DelegatePerTargetObjectIntroductionInterceptor extends Introduction
|
||||
/**
|
||||
* Hold weak references to keys as we don't want to interfere with garbage collection..
|
||||
*/
|
||||
private final Map<Object, Object> delegateMap = new WeakHashMap<Object, Object>();
|
||||
private final Map<Object, Object> delegateMap = new WeakHashMap<>();
|
||||
|
||||
private Class<?> defaultImplType;
|
||||
|
||||
|
||||
@@ -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,9 +43,9 @@ import org.springframework.util.ClassUtils;
|
||||
@SuppressWarnings("serial")
|
||||
public class IntroductionInfoSupport implements IntroductionInfo, Serializable {
|
||||
|
||||
protected final Set<Class<?>> publishedInterfaces = new LinkedHashSet<Class<?>>();
|
||||
protected final Set<Class<?>> publishedInterfaces = new LinkedHashSet<>();
|
||||
|
||||
private transient Map<Method, Boolean> rememberedMethods = new ConcurrentHashMap<Method, Boolean>(32);
|
||||
private transient Map<Method, Boolean> rememberedMethods = new ConcurrentHashMap<>(32);
|
||||
|
||||
|
||||
/**
|
||||
@@ -118,7 +118,7 @@ public class IntroductionInfoSupport implements IntroductionInfo, Serializable {
|
||||
// Rely on default serialization; just initialize state after deserialization.
|
||||
ois.defaultReadObject();
|
||||
// Initialize transient fields.
|
||||
this.rememberedMethods = new ConcurrentHashMap<Method, Boolean>(32);
|
||||
this.rememberedMethods = new ConcurrentHashMap<>(32);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 @@ import org.springframework.util.PatternMatchUtils;
|
||||
@SuppressWarnings("serial")
|
||||
public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut implements Serializable {
|
||||
|
||||
private List<String> mappedNames = new LinkedList<String>();
|
||||
private List<String> mappedNames = new LinkedList<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -56,7 +56,7 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
|
||||
* the pointcut matches.
|
||||
*/
|
||||
public void setMappedNames(String... mappedNames) {
|
||||
this.mappedNames = new LinkedList<String>();
|
||||
this.mappedNames = new LinkedList<>();
|
||||
if (mappedNames != null) {
|
||||
this.mappedNames.addAll(Arrays.asList(mappedNames));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -265,7 +265,7 @@ public class CommonsPool2TargetSource extends AbstractPoolingTargetSource implem
|
||||
|
||||
@Override
|
||||
public PooledObject<Object> makeObject() throws Exception {
|
||||
return new DefaultPooledObject<Object>(newPrototypeInstance());
|
||||
return new DefaultPooledObject<>(newPrototypeInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.
|
||||
@@ -58,12 +58,12 @@ public class ThreadLocalTargetSource extends AbstractPrototypeBasedTargetSource
|
||||
* is meant to be per thread per instance of the ThreadLocalTargetSource class.
|
||||
*/
|
||||
private final ThreadLocal<Object> targetInThread =
|
||||
new NamedThreadLocal<Object>("Thread-local instance of bean '" + getTargetBeanName() + "'");
|
||||
new NamedThreadLocal<>("Thread-local instance of bean '" + getTargetBeanName() + "'");
|
||||
|
||||
/**
|
||||
* Set of managed targets, enabling us to keep track of the targets we've created.
|
||||
*/
|
||||
private final Set<Object> targetSet = new HashSet<Object>();
|
||||
private final Set<Object> targetSet = new HashSet<>();
|
||||
|
||||
private int invocationCount;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -41,7 +41,7 @@ public class TigerAspectJExpressionPointcutTests {
|
||||
// TODO factor into static in AspectJExpressionPointcut
|
||||
private Method getAge;
|
||||
|
||||
private Map<String,Method> methodsOnHasGeneric = new HashMap<String,Method>();
|
||||
private Map<String,Method> methodsOnHasGeneric = new HashMap<>();
|
||||
|
||||
|
||||
@Before
|
||||
|
||||
@@ -138,7 +138,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
|
||||
int realAge = 65;
|
||||
target.setAge(realAge);
|
||||
|
||||
List<Advisor> advisors = new LinkedList<Advisor>();
|
||||
List<Advisor> advisors = new LinkedList<>();
|
||||
PerTargetAspect aspect1 = new PerTargetAspect();
|
||||
aspect1.count = 100;
|
||||
aspect1.setOrder(10);
|
||||
@@ -166,7 +166,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
|
||||
int realAge = 65;
|
||||
target.setAge(realAge);
|
||||
|
||||
List<Advisor> advisors = new LinkedList<Advisor>();
|
||||
List<Advisor> advisors = new LinkedList<>();
|
||||
PerTargetAspectWithOrderAnnotation10 aspect1 = new PerTargetAspectWithOrderAnnotation10();
|
||||
aspect1.count = 100;
|
||||
advisors.addAll(
|
||||
@@ -402,7 +402,7 @@ public abstract class AbstractAspectJAdvisorFactoryTests {
|
||||
|
||||
@Test
|
||||
public void testIntroductionOnTargetExcludedByTypePattern() {
|
||||
LinkedList<Object> target = new LinkedList<Object>();
|
||||
LinkedList<Object> target = new LinkedList<>();
|
||||
List<?> proxy = (List<?>) createProxy(target,
|
||||
AopUtils.findAdvisorsThatCanApply(
|
||||
getFixture().getAdvisors(new SingletonMetadataAwareAspectInstanceFactory(new MakeLockable(), "someBean")),
|
||||
|
||||
@@ -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.
|
||||
@@ -172,7 +172,7 @@ public final class AopNamespaceHandlerEventTests {
|
||||
BeanReference[] beanReferences = acd.getBeanReferences();
|
||||
assertEquals(6, beanReferences.length);
|
||||
|
||||
Set<String> expectedReferences = new HashSet<String>();
|
||||
Set<String> expectedReferences = new HashSet<>();
|
||||
expectedReferences.add("pc");
|
||||
expectedReferences.add("countingAdvice");
|
||||
for (int i = 0; i < beanReferences.length; i++) {
|
||||
|
||||
@@ -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.
|
||||
@@ -40,7 +40,7 @@ public final class MethodInvocationTests {
|
||||
Method m = Object.class.getMethod("hashCode");
|
||||
Object proxy = new Object();
|
||||
final Object returnValue = new Object();
|
||||
List<Object> is = new LinkedList<Object>();
|
||||
List<Object> is = new LinkedList<>();
|
||||
is.add(new MethodInterceptor() {
|
||||
@Override
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
@@ -65,7 +65,7 @@ public final class MethodInvocationTests {
|
||||
throw new UnsupportedOperationException("toString");
|
||||
}
|
||||
};
|
||||
List<Object> is = new LinkedList<Object>();
|
||||
List<Object> is = new LinkedList<>();
|
||||
|
||||
Method m = Object.class.getMethod("hashCode");
|
||||
Object proxy = new Object();
|
||||
|
||||
@@ -345,7 +345,7 @@ public class ProxyFactoryTests {
|
||||
public void testInterfaceProxiesCanBeOrderedThroughAnnotations() {
|
||||
Object proxy1 = new ProxyFactory(new A()).getProxy();
|
||||
Object proxy2 = new ProxyFactory(new B()).getProxy();
|
||||
List<Object> list = new ArrayList<Object>(2);
|
||||
List<Object> list = new ArrayList<>(2);
|
||||
list.add(proxy1);
|
||||
list.add(proxy2);
|
||||
AnnotationAwareOrderComparator.sort(list);
|
||||
@@ -361,7 +361,7 @@ public class ProxyFactoryTests {
|
||||
pf2.setProxyTargetClass(true);
|
||||
Object proxy1 = pf1.getProxy();
|
||||
Object proxy2 = pf2.getProxy();
|
||||
List<Object> list = new ArrayList<Object>(2);
|
||||
List<Object> list = new ArrayList<>(2);
|
||||
list.add(proxy1);
|
||||
list.add(proxy2);
|
||||
AnnotationAwareOrderComparator.sort(list);
|
||||
|
||||
@@ -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.
|
||||
@@ -30,7 +30,7 @@ import java.util.HashMap;
|
||||
public class MethodCounter implements Serializable {
|
||||
|
||||
/** Method name --> count, does not understand overloading */
|
||||
private HashMap<String, Integer> map = new HashMap<String, Integer>();
|
||||
private HashMap<String, Integer> map = new HashMap<>();
|
||||
|
||||
private int allCount;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -143,9 +143,9 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
||||
*/
|
||||
private final XmlBeanDefinitionReader groovyDslXmlBeanDefinitionReader;
|
||||
|
||||
private final Map<String, String> namespaces = new HashMap<String, String>();
|
||||
private final Map<String, String> namespaces = new HashMap<>();
|
||||
|
||||
private final Map<String, DeferredProperty> deferredProperties = new HashMap<String, DeferredProperty>();
|
||||
private final Map<String, DeferredProperty> deferredProperties = new HashMap<>();
|
||||
|
||||
private MetaClass metaClass = GroovySystem.getMetaClassRegistry().getMetaClass(getClass());
|
||||
|
||||
@@ -568,7 +568,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
||||
}
|
||||
}
|
||||
if (containsRuntimeRefs) {
|
||||
Map<Object, Object> managedMap = new ManagedMap<Object, Object>();
|
||||
Map<Object, Object> managedMap = new ManagedMap<>();
|
||||
managedMap.putAll(map);
|
||||
return managedMap;
|
||||
}
|
||||
@@ -590,7 +590,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
||||
}
|
||||
}
|
||||
if (containsRuntimeRefs) {
|
||||
List<Object> managedList = new ManagedList<Object>();
|
||||
List<Object> managedList = new ManagedList<>();
|
||||
managedList.addAll(list);
|
||||
return managedList;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -52,7 +52,7 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
|
||||
private static final String DESTROY_METHOD = "destroyMethod";
|
||||
private static final String SINGLETON = "singleton";
|
||||
|
||||
private static final List<String> dynamicProperties = new ArrayList<String>(8);
|
||||
private static final List<String> dynamicProperties = new ArrayList<>(8);
|
||||
|
||||
static {
|
||||
dynamicProperties.add(PARENT);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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() &&
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user