Skip to content

Commit d1a34b9

Browse files
committed
Polishing
1 parent ace2e62 commit d1a34b9

File tree

11 files changed

+74
-62
lines changed

11 files changed

+74
-62
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -328,10 +328,11 @@ private Callback[] getCallbacks(Class<?> rootClass) throws Exception {
328328

329329
// TODO: small memory optimization here (can skip creation for methods with no advice)
330330
for (int x = 0; x < methods.length; x++) {
331-
List<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(methods[x], rootClass);
331+
Method method = methods[x];
332+
List<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, rootClass);
332333
fixedCallbacks[x] = new FixedChainStaticTargetInterceptor(
333334
chain, this.advised.getTargetSource().getTarget(), this.advised.getTargetClass());
334-
this.fixedInterceptorMap.put(methods[x].toString(), x);
335+
this.fixedInterceptorMap.put(methods.toString(), x);
335336
}
336337

337338
// Now copy both the callbacks from mainCallbacks
@@ -614,8 +615,8 @@ public FixedChainStaticTargetInterceptor(List<Object> adviceChain, Object target
614615

615616
@Override
616617
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
617-
MethodInvocation invocation = new CglibMethodInvocation(proxy, this.target, method, args,
618-
this.targetClass, this.adviceChain, methodProxy);
618+
MethodInvocation invocation = new CglibMethodInvocation(
619+
proxy, this.target, method, args, this.targetClass, this.adviceChain, methodProxy);
619620
// If we get here, we need to create a MethodInvocation.
620621
Object retVal = invocation.proceed();
621622
retVal = processReturnType(proxy, this.target, method, retVal);
@@ -783,7 +784,7 @@ public ProxyCallbackFilter(AdvisedSupport advised, Map<String, Integer> fixedInt
783784
* <dt>For advised methods:</dt>
784785
* <dd>If the target is static and the advice chain is frozen then a
785786
* FixedChainStaticTargetInterceptor specific to the method is used to
786-
* invoke the advice chain. Otherwise a DyanmicAdvisedInterceptor is
787+
* invoke the advice chain. Otherwise a DynamicAdvisedInterceptor is
787788
* used.</dd>
788789
* <dt>For non-advised methods:</dt>
789790
* <dd>Where it can be determined that the method will not return {@code this}

spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.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-2019 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.
@@ -152,7 +152,7 @@ public void setArguments(Object... arguments) {
152152

153153
@Override
154154
public Object proceed() throws Throwable {
155-
// We start with an index of -1 and increment early.
155+
// We start with an index of -1 and increment early.
156156
if (this.currentInterceptorIndex == this.interceptorsAndDynamicMethodMatchers.size() - 1) {
157157
return invokeJoinpoint();
158158
}

spring-aop/src/main/java/org/springframework/aop/support/ComposablePointcut.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -24,12 +24,15 @@
2424
import org.springframework.util.Assert;
2525

2626
/**
27-
* Convenient class for building up pointcuts. All methods return
28-
* ComposablePointcut, so we can use a concise idiom like:
27+
* Convenient class for building up pointcuts.
2928
*
30-
* {@code
31-
* Pointcut pc = new ComposablePointcut().union(classFilter).intersection(methodMatcher).intersection(pointcut);
32-
* }
29+
* <p>All methods return {@code ComposablePointcut}, so we can use concise idioms
30+
* like in the following example.
31+
*
32+
* <pre class="code">Pointcut pc = new ComposablePointcut()
33+
* .union(classFilter)
34+
* .intersection(methodMatcher)
35+
* .intersection(pointcut);</pre>
3336
*
3437
* @author Rod Johnson
3538
* @author Juergen Hoeller
@@ -199,7 +202,7 @@ public int hashCode() {
199202

200203
@Override
201204
public String toString() {
202-
return "ComposablePointcut: " + this.classFilter + ", " +this.methodMatcher;
205+
return "ComposablePointcut: " + this.classFilter + ", " + this.methodMatcher;
203206
}
204207

205208
}

spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -38,7 +38,7 @@
3838
* @author Juergen Hoeller
3939
* @since 11.11.2003
4040
*/
41-
@SuppressWarnings({"serial" })
41+
@SuppressWarnings("serial")
4242
public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFilter, Ordered, Serializable {
4343

4444
private final Advice advice;
@@ -81,25 +81,25 @@ public DefaultIntroductionAdvisor(Advice advice, IntroductionInfo introductionIn
8181
/**
8282
* Create a DefaultIntroductionAdvisor for the given advice.
8383
* @param advice the Advice to apply
84-
* @param intf the interface to introduce
84+
* @param ifc the interface to introduce
8585
*/
86-
public DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class<?> intf) {
86+
public DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class<?> ifc) {
8787
Assert.notNull(advice, "Advice must not be null");
8888
this.advice = advice;
89-
addInterface(intf);
89+
addInterface(ifc);
9090
}
9191

9292

9393
/**
9494
* Add the specified interface to the list of interfaces to introduce.
95-
* @param intf the interface to introduce
95+
* @param ifc the interface to introduce
9696
*/
97-
public void addInterface(Class<?> intf) {
98-
Assert.notNull(intf, "Interface must not be null");
99-
if (!intf.isInterface()) {
100-
throw new IllegalArgumentException("Specified class [" + intf.getName() + "] must be an interface");
97+
public void addInterface(Class<?> ifc) {
98+
Assert.notNull(ifc, "Interface must not be null");
99+
if (!ifc.isInterface()) {
100+
throw new IllegalArgumentException("Specified class [" + ifc.getName() + "] must be an interface");
101101
}
102-
this.interfaces.add(intf);
102+
this.interfaces.add(ifc);
103103
}
104104

105105
@Override
@@ -112,8 +112,8 @@ public void validateInterfaces() throws IllegalArgumentException {
112112
for (Class<?> ifc : this.interfaces) {
113113
if (this.advice instanceof DynamicIntroductionAdvice &&
114114
!((DynamicIntroductionAdvice) this.advice).implementsInterface(ifc)) {
115-
throw new IllegalArgumentException("DynamicIntroductionAdvice [" + this.advice + "] " +
116-
"does not implement interface [" + ifc.getName() + "] specified for introduction");
115+
throw new IllegalArgumentException("DynamicIntroductionAdvice [" + this.advice + "] " +
116+
"does not implement interface [" + ifc.getName() + "] specified for introduction");
117117
}
118118
}
119119
}

spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -26,8 +26,9 @@
2626
import org.springframework.util.PatternMatchUtils;
2727

2828
/**
29-
* Pointcut bean for simple method name matches, as alternative to regexp patterns.
30-
* Does not handle overloaded methods: all methods with a given name will be eligible.
29+
* Pointcut bean for simple method name matches, as an alternative to regexp patterns.
30+
*
31+
* <p>Does not handle overloaded methods: all methods with a given name will be eligible.
3132
*
3233
* @author Juergen Hoeller
3334
* @author Rod Johnson

spring-aop/src/main/java/org/springframework/aop/support/Pointcuts.java

Lines changed: 3 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-2019 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.
@@ -26,7 +26,8 @@
2626
/**
2727
* Pointcut constants for matching getters and setters,
2828
* and static methods useful for manipulating and evaluating pointcuts.
29-
* These methods are particularly useful for composing pointcuts
29+
*
30+
* <p>These methods are particularly useful for composing pointcuts
3031
* using the union and intersection methods.
3132
*
3233
* @author Rod Johnson

spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMatchingPointcut.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -61,7 +61,7 @@ public AnnotationMatchingPointcut(Class<? extends Annotation> classAnnotationTyp
6161
}
6262

6363
/**
64-
* Create a new AnnotationMatchingPointcut for the given annotation type.
64+
* Create a new AnnotationMatchingPointcut for the given annotation types.
6565
* @param classAnnotationType the annotation type to look for at the class level
6666
* (can be {@code null})
6767
* @param methodAnnotationType the annotation type to look for at the method level
@@ -119,7 +119,7 @@ public int hashCode() {
119119

120120
@Override
121121
public String toString() {
122-
return "AnnotationMatchingPointcut: " + this.classFilter + ", " +this.methodMatcher;
122+
return "AnnotationMatchingPointcut: " + this.classFilter + ", " + this.methodMatcher;
123123
}
124124

125125

spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -141,9 +141,10 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
141141

142142

143143
/**
144-
* Create a new AutowiredAnnotationBeanPostProcessor
145-
* for Spring's standard {@link Autowired} annotation.
146-
* <p>Also supports JSR-330's {@link javax.inject.Inject} annotation, if available.
144+
* Create a new {@code AutowiredAnnotationBeanPostProcessor} for Spring's
145+
* standard {@link Autowired @Autowired} annotation.
146+
* <p>Also supports JSR-330's {@link javax.inject.Inject @Inject} annotation,
147+
* if available.
147148
*/
148149
@SuppressWarnings("unchecked")
149150
public AutowiredAnnotationBeanPostProcessor() {
@@ -239,7 +240,7 @@ public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, C
239240
public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, final String beanName)
240241
throws BeanCreationException {
241242

242-
// Let's check for lookup methods here..
243+
// Let's check for lookup methods here...
243244
if (!this.lookupMethodsChecked.contains(beanName)) {
244245
try {
245246
ReflectionUtils.doWithMethods(beanClass, new ReflectionUtils.MethodCallback() {
@@ -249,7 +250,8 @@ public void doWith(Method method) throws IllegalArgumentException, IllegalAccess
249250
if (lookup != null) {
250251
LookupOverride override = new LookupOverride(method, lookup.value());
251252
try {
252-
RootBeanDefinition mbd = (RootBeanDefinition) beanFactory.getMergedBeanDefinition(beanName);
253+
RootBeanDefinition mbd = (RootBeanDefinition)
254+
beanFactory.getMergedBeanDefinition(beanName);
253255
mbd.getMethodOverrides().addOverride(override);
254256
}
255257
catch (NoSuchBeanDefinitionException ex) {

spring-beans/src/main/java/org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -246,7 +246,7 @@ public MethodOverrideCallbackFilter(RootBeanDefinition beanDefinition) {
246246
public int accept(Method method) {
247247
MethodOverride methodOverride = getBeanDefinition().getMethodOverrides().getOverride(method);
248248
if (logger.isTraceEnabled()) {
249-
logger.trace("Override for '" + method.getName() + "' is [" + methodOverride + "]");
249+
logger.trace("MethodOverride for " + method + ": " + methodOverride);
250250
}
251251
if (methodOverride == null) {
252252
return PASSTHROUGH;

spring-beans/src/main/java/org/springframework/beans/factory/support/MethodOverrides.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -121,7 +121,6 @@ public boolean equals(Object other) {
121121
}
122122
MethodOverrides that = (MethodOverrides) other;
123123
return this.overrides.equals(that.overrides);
124-
125124
}
126125

127126
@Override

0 commit comments

Comments
 (0)