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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user