Skip to content

Commit 00d2606

Browse files
committed
Explicit type can be replaced by <>
Issue: SPR-13188
1 parent 3096888 commit 00d2606

File tree

1,044 files changed

+3972
-3893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,044 files changed

+3972
-3893
lines changed

spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -461,7 +461,7 @@ protected ParameterNameDiscoverer createParameterNameDiscoverer() {
461461
}
462462

463463
private void bindExplicitArguments(int numArgumentsLeftToBind) {
464-
this.argumentBindings = new HashMap<String, Integer>();
464+
this.argumentBindings = new HashMap<>();
465465

466466
int numExpectedArgumentNames = this.aspectJAdviceMethod.getParameterTypes().length;
467467
if (this.argumentNames.length != numExpectedArgumentNames) {

spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -130,8 +130,8 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
130130
private static final int STEP_REFERENCE_PCUT_BINDING = 7;
131131
private static final int STEP_FINISHED = 8;
132132

133-
private static final Set<String> singleValuedAnnotationPcds = new HashSet<String>();
134-
private static final Set<String> nonReferencePointcutTokens = new HashSet<String>();
133+
private static final Set<String> singleValuedAnnotationPcds = new HashSet<>();
134+
private static final Set<String> nonReferencePointcutTokens = new HashSet<>();
135135

136136

137137
static {
@@ -414,7 +414,7 @@ private void maybeBindReturningVariable() {
414414
* <p>Some more support from AspectJ in doing this exercise would be nice... :)
415415
*/
416416
private void maybeBindAnnotationsFromPointcutExpression() {
417-
List<String> varNames = new ArrayList<String>();
417+
List<String> varNames = new ArrayList<>();
418418
String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
419419
for (int i = 0; i < tokens.length; i++) {
420420
String toMatch = tokens[i];
@@ -520,7 +520,7 @@ private void maybeBindThisOrTargetOrArgsFromPointcutExpression() {
520520
+ " unbound args at this(),target(),args() binding stage, with no way to determine between them");
521521
}
522522

523-
List<String> varNames = new ArrayList<String>();
523+
List<String> varNames = new ArrayList<>();
524524
String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
525525
for (int i = 0; i < tokens.length; i++) {
526526
if (tokens[i].equals("this") ||
@@ -537,7 +537,7 @@ private void maybeBindThisOrTargetOrArgsFromPointcutExpression() {
537537
else if (tokens[i].equals("args") || tokens[i].startsWith("args(")) {
538538
PointcutBody body = getPointcutBody(tokens, i);
539539
i += body.numTokensConsumed;
540-
List<String> candidateVarNames = new ArrayList<String>();
540+
List<String> candidateVarNames = new ArrayList<>();
541541
maybeExtractVariableNamesFromArgs(body.text, candidateVarNames);
542542
// we may have found some var names that were bound in previous primitive args binding step,
543543
// filter them out...
@@ -571,7 +571,7 @@ private void maybeBindReferencePointcutParameter() {
571571
+ " unbound args at reference pointcut binding stage, with no way to determine between them");
572572
}
573573

574-
List<String> varNames = new ArrayList<String>();
574+
List<String> varNames = new ArrayList<>();
575575
String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
576576
for (int i = 0; i < tokens.length; i++) {
577577
String toMatch = tokens[i];
@@ -683,7 +683,7 @@ private void maybeBindPrimitiveArgsFromPointcutExpression() {
683683
}
684684
if (numUnboundPrimitives == 1) {
685685
// Look for arg variable and bind it if we find exactly one...
686-
List<String> varNames = new ArrayList<String>();
686+
List<String> varNames = new ArrayList<>();
687687
String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
688688
for (int i = 0; i < tokens.length; i++) {
689689
if (tokens[i].equals("args") || tokens[i].startsWith("args(")) {

spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -82,7 +82,7 @@
8282
public class AspectJExpressionPointcut extends AbstractExpressionPointcut
8383
implements ClassFilter, IntroductionAwareMethodMatcher, BeanFactoryAware {
8484

85-
private static final Set<PointcutPrimitive> SUPPORTED_PRIMITIVES = new HashSet<PointcutPrimitive>();
85+
private static final Set<PointcutPrimitive> SUPPORTED_PRIMITIVES = new HashSet<>();
8686

8787
static {
8888
SUPPORTED_PRIMITIVES.add(PointcutPrimitive.EXECUTION);
@@ -112,7 +112,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
112112

113113
private transient PointcutExpression pointcutExpression;
114114

115-
private transient Map<Method, ShadowMatch> shadowMatchCache = new ConcurrentHashMap<Method, ShadowMatch>(32);
115+
private transient Map<Method, ShadowMatch> shadowMatchCache = new ConcurrentHashMap<>(32);
116116

117117

118118
/**
@@ -628,7 +628,7 @@ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound
628628

629629
// Initialize transient fields.
630630
// pointcutExpression will be initialized lazily by checkReadyToMatch()
631-
this.shadowMatchCache = new ConcurrentHashMap<Method, ShadowMatch>(32);
631+
this.shadowMatchCache = new ConcurrentHashMap<>(32);
632632
}
633633

634634

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -184,7 +184,7 @@ protected static AspectJAnnotation<?> findAspectJAnnotationOnMethod(Method metho
184184
private static <A extends Annotation> AspectJAnnotation<A> findAnnotation(Method method, Class<A> toLookFor) {
185185
A result = AnnotationUtils.findAnnotation(method, toLookFor);
186186
if (result != null) {
187-
return new AspectJAnnotation<A>(result);
187+
return new AspectJAnnotation<>(result);
188188
}
189189
else {
190190
return null;
@@ -212,7 +212,7 @@ protected static class AspectJAnnotation<A extends Annotation> {
212212
private static final String[] EXPRESSION_PROPERTIES = new String[] {"value", "pointcut"};
213213

214214
private static Map<Class<?>, AspectJAnnotationType> annotationTypes =
215-
new HashMap<Class<?>, AspectJAnnotationType>();
215+
new HashMap<>();
216216

217217
static {
218218
annotationTypes.put(Pointcut.class,AspectJAnnotationType.AtPointcut);

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AnnotationAwareAspectJAutoProxyCreator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -60,7 +60,7 @@ public class AnnotationAwareAspectJAutoProxyCreator extends AspectJAwareAdvisorA
6060
* <p>Default is to consider all @AspectJ beans as eligible.
6161
*/
6262
public void setIncludePatterns(List<String> patterns) {
63-
this.includePatterns = new ArrayList<Pattern>(patterns.size());
63+
this.includePatterns = new ArrayList<>(patterns.size());
6464
for (String patternText : patterns) {
6565
this.includePatterns.add(Pattern.compile(patternText));
6666
}

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJProxyFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -50,7 +50,7 @@
5050
public class AspectJProxyFactory extends ProxyCreatorSupport {
5151

5252
/** Cache for singleton aspect instances */
53-
private static final Map<Class<?>, Object> aspectCache = new HashMap<Class<?>, Object>();
53+
private static final Map<Class<?>, Object> aspectCache = new HashMap<>();
5454

5555
private final AspectJAdvisorFactory aspectFactory = new ReflectiveAspectJAdvisorFactory();
5656

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/BeanFactoryAspectJAdvisorsBuilder.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2008 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -45,10 +45,10 @@ public class BeanFactoryAspectJAdvisorsBuilder {
4545

4646
private List<String> aspectBeanNames;
4747

48-
private final Map<String, List<Advisor>> advisorsCache = new HashMap<String, List<Advisor>>();
48+
private final Map<String, List<Advisor>> advisorsCache = new HashMap<>();
4949

5050
private final Map<String, MetadataAwareAspectInstanceFactory> aspectFactoryCache =
51-
new HashMap<String, MetadataAwareAspectInstanceFactory>();
51+
new HashMap<>();
5252

5353

5454
/**
@@ -85,8 +85,8 @@ public List<Advisor> buildAspectJAdvisors() {
8585
synchronized (this) {
8686
aspectNames = this.aspectBeanNames;
8787
if (aspectNames == null) {
88-
List<Advisor> advisors = new LinkedList<Advisor>();
89-
aspectNames = new LinkedList<String>();
88+
List<Advisor> advisors = new LinkedList<>();
89+
aspectNames = new LinkedList<>();
9090
String[] beanNames =
9191
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.beanFactory, Object.class, true, false);
9292
for (String beanName : beanNames) {
@@ -136,7 +136,7 @@ public List<Advisor> buildAspectJAdvisors() {
136136
if (aspectNames.isEmpty()) {
137137
return Collections.emptyList();
138138
}
139-
List<Advisor> advisors = new LinkedList<Advisor>();
139+
List<Advisor> advisors = new LinkedList<>();
140140
for (String aspectName : aspectNames) {
141141
List<Advisor> cachedAdvisors = this.advisorsCache.get(aspectName);
142142
if (cachedAdvisors != null) {

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -72,9 +72,9 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
7272
private static final Comparator<Method> METHOD_COMPARATOR;
7373

7474
static {
75-
CompoundComparator<Method> comparator = new CompoundComparator<Method>();
76-
comparator.addComparator(new ConvertingComparator<Method, Annotation>(
77-
new InstanceComparator<Annotation>(
75+
CompoundComparator<Method> comparator = new CompoundComparator<>();
76+
comparator.addComparator(new ConvertingComparator<>(
77+
new InstanceComparator<>(
7878
Around.class, Before.class, After.class, AfterReturning.class, AfterThrowing.class),
7979
new Converter<Method, Annotation>() {
8080
@Override
@@ -84,7 +84,7 @@ public Annotation convert(Method method) {
8484
return (annotation != null ? annotation.getAnnotation() : null);
8585
}
8686
}));
87-
comparator.addComparator(new ConvertingComparator<Method, String>(
87+
comparator.addComparator(new ConvertingComparator<>(
8888
new Converter<Method, String>() {
8989
@Override
9090
public String convert(Method method) {
@@ -106,7 +106,7 @@ public List<Advisor> getAdvisors(MetadataAwareAspectInstanceFactory aspectInstan
106106
MetadataAwareAspectInstanceFactory lazySingletonAspectInstanceFactory =
107107
new LazySingletonAspectInstanceFactoryDecorator(aspectInstanceFactory);
108108

109-
List<Advisor> advisors = new LinkedList<Advisor>();
109+
List<Advisor> advisors = new LinkedList<>();
110110
for (Method method : getAdvisorMethods(aspectClass)) {
111111
Advisor advisor = getAdvisor(method, lazySingletonAspectInstanceFactory, advisors.size(), aspectName);
112112
if (advisor != null) {
@@ -132,7 +132,7 @@ public List<Advisor> getAdvisors(MetadataAwareAspectInstanceFactory aspectInstan
132132
}
133133

134134
private List<Method> getAdvisorMethods(Class<?> aspectClass) {
135-
final List<Method> methods = new LinkedList<Method>();
135+
final List<Method> methods = new LinkedList<>();
136136
ReflectionUtils.doWithMethods(aspectClass, new ReflectionUtils.MethodCallback() {
137137
@Override
138138
public void doWith(Method method) throws IllegalArgumentException {

spring-aop/src/main/java/org/springframework/aop/aspectj/autoproxy/AspectJAwareAdvisorAutoProxyCreator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -68,15 +68,15 @@ public class AspectJAwareAdvisorAutoProxyCreator extends AbstractAdvisorAutoProx
6868
@SuppressWarnings("unchecked")
6969
protected List<Advisor> sortAdvisors(List<Advisor> advisors) {
7070
List<PartiallyComparableAdvisorHolder> partiallyComparableAdvisors =
71-
new ArrayList<PartiallyComparableAdvisorHolder>(advisors.size());
71+
new ArrayList<>(advisors.size());
7272
for (Advisor element : advisors) {
7373
partiallyComparableAdvisors.add(
7474
new PartiallyComparableAdvisorHolder(element, DEFAULT_PRECEDENCE_COMPARATOR));
7575
}
7676
List<PartiallyComparableAdvisorHolder> sorted =
7777
PartialOrder.sort(partiallyComparableAdvisors);
7878
if (sorted != null) {
79-
List<Advisor> result = new ArrayList<Advisor>(advisors.size());
79+
List<Advisor> result = new ArrayList<>(advisors.size());
8080
for (PartiallyComparableAdvisorHolder pcAdvisor : sorted) {
8181
result.add(pcAdvisor.getAdvisor());
8282
}

spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public abstract class AopConfigUtils {
5454
/**
5555
* Stores the auto proxy creator classes in escalation order.
5656
*/
57-
private static final List<Class<?>> APC_PRIORITY_LIST = new ArrayList<Class<?>>();
57+
private static final List<Class<?>> APC_PRIORITY_LIST = new ArrayList<>();
5858

5959
/**
6060
* Setup the escalation list.

spring-aop/src/main/java/org/springframework/aop/config/AspectJAutoProxyBeanDefinitionParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ private void extendBeanDefinition(Element element, ParserContext parserContext)
5353
}
5454

5555
private void addIncludePatterns(Element element, ParserContext parserContext, BeanDefinition beanDef) {
56-
ManagedList<TypedStringValue> includePatterns = new ManagedList<TypedStringValue>();
56+
ManagedList<TypedStringValue> includePatterns = new ManagedList<>();
5757
NodeList childNodes = element.getChildNodes();
5858
for (int i = 0; i < childNodes.getLength(); i++) {
5959
Node node = childNodes.item(i);

spring-aop/src/main/java/org/springframework/aop/config/ConfigBeanDefinitionParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -199,8 +199,8 @@ private void parseAspect(Element aspectElement, ParserContext parserContext) {
199199

200200
try {
201201
this.parseState.push(new AspectEntry(aspectId, aspectName));
202-
List<BeanDefinition> beanDefinitions = new ArrayList<BeanDefinition>();
203-
List<BeanReference> beanReferences = new ArrayList<BeanReference>();
202+
List<BeanDefinition> beanDefinitions = new ArrayList<>();
203+
List<BeanReference> beanReferences = new ArrayList<>();
204204

205205
List<Element> declareParents = DomUtils.getChildElementsByTagName(aspectElement, DECLARE_PARENTS);
206206
for (int i = METHOD_INDEX; i < declareParents.size(); i++) {

spring-aop/src/main/java/org/springframework/aop/framework/AbstractAdvisingBeanPostProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ public abstract class AbstractAdvisingBeanPostProcessor extends ProxyProcessorSu
3737

3838
protected boolean beforeExistingAdvisors = false;
3939

40-
private final Map<Class<?>, Boolean> eligibleBeans = new ConcurrentHashMap<Class<?>, Boolean>(256);
40+
private final Map<Class<?>, Boolean> eligibleBeans = new ConcurrentHashMap<>(256);
4141

4242

4343
/**

spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
8787
* Interfaces to be implemented by the proxy. Held in List to keep the order
8888
* of registration, to create JDK proxy with specified order of interfaces.
8989
*/
90-
private List<Class<?>> interfaces = new ArrayList<Class<?>>();
90+
private List<Class<?>> interfaces = new ArrayList<>();
9191

9292
/**
9393
* List of Advisors. If an Advice is added, it will be wrapped
9494
* in an Advisor before being added to this List.
9595
*/
96-
private List<Advisor> advisors = new LinkedList<Advisor>();
96+
private List<Advisor> advisors = new LinkedList<>();
9797

9898
/**
9999
* Array updated on changes to the advisors list, which is easier
@@ -122,7 +122,7 @@ public AdvisedSupport(Class<?>... interfaces) {
122122
* Initialize the method cache.
123123
*/
124124
private void initMethodCache() {
125-
this.methodCache = new ConcurrentHashMap<MethodCacheKey, List<Object>>(32);
125+
this.methodCache = new ConcurrentHashMap<>(32);
126126
}
127127

128128

@@ -506,7 +506,7 @@ protected void adviceChanged() {
506506
* @param other the AdvisedSupport object to copy configuration from
507507
*/
508508
protected void copyConfigurationFrom(AdvisedSupport other) {
509-
copyConfigurationFrom(other, other.targetSource, new ArrayList<Advisor>(other.advisors));
509+
copyConfigurationFrom(other, other.targetSource, new ArrayList<>(other.advisors));
510510
}
511511

512512
/**
@@ -520,7 +520,7 @@ protected void copyConfigurationFrom(AdvisedSupport other, TargetSource targetSo
520520
copyFrom(other);
521521
this.targetSource = targetSource;
522522
this.advisorChainFactory = other.advisorChainFactory;
523-
this.interfaces = new ArrayList<Class<?>>(other.interfaces);
523+
this.interfaces = new ArrayList<>(other.interfaces);
524524
for (Advisor advisor : advisors) {
525525
if (advisor instanceof IntroductionAdvisor) {
526526
validateIntroductionAdvisor((IntroductionAdvisor) advisor);

spring-aop/src/main/java/org/springframework/aop/framework/AopContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ public abstract class AopContext {
4646
* the controlling proxy configuration has been set to "true".
4747
* @see ProxyConfig#setExposeProxy
4848
*/
49-
private static final ThreadLocal<Object> currentProxy = new NamedThreadLocal<Object>("Current AOP proxy");
49+
private static final ThreadLocal<Object> currentProxy = new NamedThreadLocal<>("Current AOP proxy");
5050

5151

5252
/**

0 commit comments

Comments
 (0)