Skip to content

Commit 21a49ef

Browse files
committed
Polish whitespace in *.aj
Previously we had restored the whitespace for *.aj files in 6888a6f to avoid a but in aspectj. We have updated to the latest version of apsectj and restored the changes in commit 6888a6f which included a significant cleanup of whitespace. Issue: SPR-10208
1 parent 1bae80a commit 21a49ef

13 files changed

+123
-106
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ configure(allprojects) { project ->
1212
group = "org.springframework"
1313
version = qualifyVersionIfNecessary(version)
1414

15-
ext.aspectjVersion = "1.7.1"
15+
ext.aspectjVersion = "1.7.2"
1616
ext.easymockVersion = "2.5.2"
1717
ext.hsqldbVersion = "1.8.0.10"
1818
ext.junitVersion = "4.11"

spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerAspect.aj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
16+
1717
package org.springframework.beans.factory.aspectj;
1818

1919
import org.aspectj.lang.annotation.SuppressAjWarnings;
@@ -23,12 +23,12 @@ import org.springframework.beans.factory.wiring.BeanConfigurerSupport;
2323
* Abstract superaspect for AspectJ aspects that can perform Dependency
2424
* Injection on objects, however they may be created. Define the beanCreation()
2525
* pointcut in subaspects.
26-
*
26+
*
2727
* <p>Subaspects may also need a metadata resolution strategy, in the
28-
* <code>BeanWiringInfoResolver</code> interface. The default implementation
28+
* {@code BeanWiringInfoResolver} interface. The default implementation
2929
* looks for a bean with the same name as the FQN. This is the default name
3030
* of a bean in a Spring container if the id value is not supplied explicitly.
31-
*
31+
*
3232
* @author Rob Harrop
3333
* @author Rod Johnson
3434
* @author Adrian Colyer
@@ -62,7 +62,7 @@ public abstract aspect AbstractBeanConfigurerAspect extends BeanConfigurerSuppor
6262

6363
/**
6464
* The initialization of a new object.
65-
*
65+
*
6666
* <p>WARNING: Although this pointcut is non-abstract for backwards
6767
* compatibility reasons, it is meant to be overridden to select
6868
* initialization of any configurable bean.

spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/AbstractDependencyInjectionAspect.aj

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,85 +17,87 @@
1717
package org.springframework.beans.factory.aspectj;
1818

1919
import org.aspectj.lang.annotation.SuppressAjWarnings;
20+
import org.aspectj.lang.annotation.control.CodeGenerationHint;
2021

2122
/**
2223
* Abstract base aspect that can perform Dependency
2324
* Injection on objects, however they may be created.
24-
*
25+
*
2526
* @author Ramnivas Laddad
2627
* @since 2.5.2
2728
*/
2829
public abstract aspect AbstractDependencyInjectionAspect {
2930
/**
3031
* Select construction join points for objects to inject dependencies
3132
*/
32-
public abstract pointcut beanConstruction(Object bean);
33+
public abstract pointcut beanConstruction(Object bean);
3334

3435
/**
3536
* Select deserialization join points for objects to inject dependencies
3637
*/
3738
public abstract pointcut beanDeserialization(Object bean);
38-
39+
3940
/**
4041
* Select join points in a configurable bean
4142
*/
4243
public abstract pointcut inConfigurableBean();
43-
44+
4445
/**
4546
* Select join points in beans to be configured prior to construction?
4647
* By default, use post-construction injection matching the default in the Configurable annotation.
4748
*/
4849
public pointcut preConstructionConfiguration() : if(false);
49-
50+
5051
/**
51-
* Select the most-specific initialization join point
52+
* Select the most-specific initialization join point
5253
* (most concrete class) for the initialization of an instance.
5354
*/
55+
@CodeGenerationHint(ifNameSuffix="6f1")
5456
public pointcut mostSpecificSubTypeConstruction() :
5557
if(thisJoinPoint.getSignature().getDeclaringType() == thisJoinPoint.getThis().getClass());
5658

5759
/**
5860
* Select least specific super type that is marked for DI (so that injection occurs only once with pre-construction inejection
5961
*/
6062
public abstract pointcut leastSpecificSuperTypeConstruction();
61-
63+
6264
/**
6365
* Configure the bean
6466
*/
6567
public abstract void configureBean(Object bean);
6668

67-
68-
private pointcut preConstructionCondition() :
69+
70+
private pointcut preConstructionCondition() :
6971
leastSpecificSuperTypeConstruction() && preConstructionConfiguration();
70-
72+
7173
private pointcut postConstructionCondition() :
7274
mostSpecificSubTypeConstruction() && !preConstructionConfiguration();
73-
75+
7476
/**
7577
* Pre-construction configuration.
7678
*/
7779
@SuppressAjWarnings("adviceDidNotMatch")
78-
before(Object bean) :
79-
beanConstruction(bean) && preConstructionCondition() && inConfigurableBean() {
80+
before(Object bean) :
81+
beanConstruction(bean) && preConstructionCondition() && inConfigurableBean() {
8082
configureBean(bean);
8183
}
8284

8385
/**
8486
* Post-construction configuration.
8587
*/
8688
@SuppressAjWarnings("adviceDidNotMatch")
87-
after(Object bean) returning :
89+
after(Object bean) returning :
8890
beanConstruction(bean) && postConstructionCondition() && inConfigurableBean() {
8991
configureBean(bean);
9092
}
91-
93+
9294
/**
9395
* Post-deserialization configuration.
9496
*/
9597
@SuppressAjWarnings("adviceDidNotMatch")
96-
after(Object bean) returning :
98+
after(Object bean) returning :
9799
beanDeserialization(bean) && inConfigurableBean() {
98100
configureBean(bean);
99101
}
100-
102+
101103
}

spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/AbstractInterfaceDrivenDependencyInjectionAspect.aj

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,94 +26,94 @@ import java.io.Serializable;
2626
* upon deserialization. Subaspects need to simply provide definition for the configureBean() method. This
2727
* method may be implemented without relying on Spring container if so desired.
2828
* </p>
29-
* <p>
29+
* <p>
3030
* There are two cases that needs to be handled:
3131
* <ol>
32-
* <li>Normal object creation via the '<code>new</code>' operator: this is
33-
* taken care of by advising <code>initialization()</code> join points.</li>
32+
* <li>Normal object creation via the '{@code new}' operator: this is
33+
* taken care of by advising {@code initialization()} join points.</li>
3434
* <li>Object creation through deserialization: since no constructor is
3535
* invoked during deserialization, the aspect needs to advise a method that a
3636
* deserialization mechanism is going to invoke. Ideally, we should not
3737
* require user classes to implement any specific method. This implies that
3838
* we need to <i>introduce</i> the chosen method. We should also handle the cases
3939
* where the chosen method is already implemented in classes (in which case,
40-
* the user's implementation for that method should take precedence over the
40+
* the user's implementation for that method should take precedence over the
4141
* introduced implementation). There are a few choices for the chosen method:
4242
* <ul>
4343
* <li>readObject(ObjectOutputStream): Java requires that the method must be
44-
* <code>private</p>. Since aspects cannot introduce a private member,
44+
* {@code private}</p>. Since aspects cannot introduce a private member,
4545
* while preserving its name, this option is ruled out.</li>
46-
* <li>readResolve(): Java doesn't pose any restriction on an access specifier.
47-
* Problem solved! There is one (minor) limitation of this approach in
48-
* that if a user class already has this method, that method must be
49-
* <code>public</code>. However, this shouldn't be a big burden, since
50-
* use cases that need classes to implement readResolve() (custom enums,
46+
* <li>readResolve(): Java doesn't pose any restriction on an access specifier.
47+
* Problem solved! There is one (minor) limitation of this approach in
48+
* that if a user class already has this method, that method must be
49+
* {@code public}. However, this shouldn't be a big burden, since
50+
* use cases that need classes to implement readResolve() (custom enums,
5151
* for example) are unlikely to be marked as &#64;Configurable, and
52-
* in any case asking to make that method <code>public</code> should not
52+
* in any case asking to make that method {@code public} should not
5353
* pose any undue burden.</li>
5454
* </ul>
55-
* The minor collaboration needed by user classes (i.e., that the
56-
* implementation of <code>readResolve()</code>, if any, must be
57-
* <code>public</code>) can be lifted as well if we were to use an
58-
* experimental feature in AspectJ - the <code>hasmethod()</code> PCD.</li>
55+
* The minor collaboration needed by user classes (i.e., that the
56+
* implementation of {@code readResolve()}, if any, must be
57+
* {@code public}) can be lifted as well if we were to use an
58+
* experimental feature in AspectJ - the {@code hasmethod()} PCD.</li>
5959
* </ol>
6060
6161
* <p>
6262
* While having type implement the {@link ConfigurableObject} interface is certainly a valid choice, an alternative
6363
* is to use a 'declare parents' statement another aspect (a subaspect of this aspect would be a logical choice)
6464
* that declares the classes that need to be configured by supplying the {@link ConfigurableObject} interface.
6565
* </p>
66-
*
66+
*
6767
* @author Ramnivas Laddad
6868
* @since 2.5.2
6969
*/
7070
public abstract aspect AbstractInterfaceDrivenDependencyInjectionAspect extends AbstractDependencyInjectionAspect {
7171
/**
7272
* Select initialization join point as object construction
7373
*/
74-
public pointcut beanConstruction(Object bean) :
75-
initialization(ConfigurableObject+.new(..)) && this(bean);
74+
public pointcut beanConstruction(Object bean) :
75+
initialization(ConfigurableObject+.new(..)) && this(bean);
7676

7777
/**
7878
* Select deserialization join point made available through ITDs for ConfigurableDeserializationSupport
7979
*/
8080
public pointcut beanDeserialization(Object bean) :
8181
execution(Object ConfigurableDeserializationSupport+.readResolve()) &&
8282
this(bean);
83-
83+
8484
public pointcut leastSpecificSuperTypeConstruction() : initialization(ConfigurableObject.new(..));
85-
86-
87-
85+
86+
87+
8888
// Implementation to support re-injecting dependencies once an object is deserialized
8989
/**
90-
* Declare any class implementing Serializable and ConfigurableObject as also implementing
91-
* ConfigurableDeserializationSupport. This allows us to introduce the readResolve()
90+
* Declare any class implementing Serializable and ConfigurableObject as also implementing
91+
* ConfigurableDeserializationSupport. This allows us to introduce the readResolve()
9292
* method and select it with the beanDeserialization() pointcut.
93-
*
93+
*
9494
* <p>Here is an improved version that uses the hasmethod() pointcut and lifts
9595
* even the minor requirement on user classes:
9696
*
9797
* <pre class="code">declare parents: ConfigurableObject+ Serializable+
98-
* && !hasmethod(Object readResolve() throws ObjectStreamException)
98+
* && !hasmethod(Object readResolve() throws ObjectStreamException)
9999
* implements ConfigurableDeserializationSupport;
100100
* </pre>
101101
*/
102-
declare parents:
102+
declare parents:
103103
ConfigurableObject+ && Serializable+ implements ConfigurableDeserializationSupport;
104-
104+
105105
/**
106-
* A marker interface to which the <code>readResolve()</code> is introduced.
106+
* A marker interface to which the {@code readResolve()} is introduced.
107107
*/
108108
static interface ConfigurableDeserializationSupport extends Serializable {
109109
}
110-
110+
111111
/**
112-
* Introduce the <code>readResolve()</code> method so that we can advise its
112+
* Introduce the {@code readResolve()} method so that we can advise its
113113
* execution to configure the object.
114-
*
114+
*
115115
* <p>Note if a method with the same signature already exists in a
116-
* <code>Serializable</code> class of ConfigurableObject type,
116+
* {@code Serializable} class of ConfigurableObject type,
117117
* that implementation will take precedence (a good thing, since we are
118118
* merely interested in an opportunity to detect deserialization.)
119119
*/

spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/AnnotationBeanConfigurerAspect.aj

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package org.springframework.beans.factory.aspectj;
1818

1919
import java.io.Serializable;
2020

21+
import org.aspectj.lang.annotation.control.CodeGenerationHint;
2122
import org.springframework.beans.BeansException;
2223
import org.springframework.beans.factory.BeanFactory;
2324
import org.springframework.beans.factory.BeanFactoryAware;
@@ -32,7 +33,7 @@ import org.springframework.beans.factory.wiring.BeanConfigurerSupport;
3233
* annotation to identify which classes need autowiring.
3334
*
3435
* <p>The bean name to look up will be taken from the
35-
* <code>&#64;Configurable</code> annotation if specified, otherwise the
36+
* {@code &#64;Configurable} annotation if specified, otherwise the
3637
* default bean name to look up will be the FQN of the class being configured.
3738
*
3839
* @author Rod Johnson
@@ -43,15 +44,15 @@ import org.springframework.beans.factory.wiring.BeanConfigurerSupport;
4344
* @see org.springframework.beans.factory.annotation.Configurable
4445
* @see org.springframework.beans.factory.annotation.AnnotationBeanWiringInfoResolver
4546
*/
46-
public aspect AnnotationBeanConfigurerAspect
47+
public aspect AnnotationBeanConfigurerAspect
4748
extends AbstractInterfaceDrivenDependencyInjectionAspect
4849
implements BeanFactoryAware, InitializingBean, DisposableBean {
4950

5051
private BeanConfigurerSupport beanConfigurerSupport = new BeanConfigurerSupport();
5152

5253
public pointcut inConfigurableBean() : @this(Configurable);
5354

54-
public pointcut preConstructionConfiguration() : preConstructionConfigurationSupport(*);
55+
public pointcut preConstructionConfiguration() : preConstructionConfigurationSupport(*);
5556

5657
declare parents: @Configurable * implements ConfigurableObject;
5758

@@ -77,13 +78,14 @@ public aspect AnnotationBeanConfigurerAspect
7778
/*
7879
* An intermediary to match preConstructionConfiguration signature (that doesn't expose the annotation object)
7980
*/
81+
@CodeGenerationHint(ifNameSuffix="bb0")
8082
private pointcut preConstructionConfigurationSupport(Configurable c) : @this(c) && if(c.preConstruction());
8183

8284
/*
83-
* This declaration shouldn't be needed,
85+
* This declaration shouldn't be needed,
8486
* except for an AspectJ bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=214559)
8587
*/
86-
declare parents: @Configurable Serializable+
88+
declare parents: @Configurable Serializable+
8789
implements ConfigurableDeserializationSupport;
8890

8991
}

spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/GenericInterfaceDrivenDependencyInjectionAspect.aj

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,38 @@ package org.springframework.beans.factory.aspectj;
1717

1818
/**
1919
* Generic-based dependency injection aspect.
20-
* <p>
21-
* This aspect allows users to implement efficient, type-safe dependency injection without
20+
* <p>
21+
* This aspect allows users to implement efficient, type-safe dependency injection without
2222
* the use of the &#64;Configurable annotation.
23-
*
24-
* The subaspect of this aspect doesn't need to include any AOP constructs.
25-
* For example, here is a subaspect that configures the <code>PricingStrategyClient</code> objects.
23+
*
24+
* The subaspect of this aspect doesn't need to include any AOP constructs.
25+
* For example, here is a subaspect that configures the {@code PricingStrategyClient} objects.
2626
* <pre>
27-
* aspect PricingStrategyDependencyInjectionAspect
27+
* aspect PricingStrategyDependencyInjectionAspect
2828
* extends GenericInterfaceDrivenDependencyInjectionAspect<PricingStrategyClient> {
2929
* private PricingStrategy pricingStrategy;
30-
*
31-
* public void configure(PricingStrategyClient bean) {
32-
* bean.setPricingStrategy(pricingStrategy);
30+
*
31+
* public void configure(PricingStrategyClient bean) {
32+
* bean.setPricingStrategy(pricingStrategy);
33+
* }
34+
*
35+
* public void setPricingStrategy(PricingStrategy pricingStrategy) {
36+
* this.pricingStrategy = pricingStrategy;
3337
* }
34-
*
35-
* public void setPricingStrategy(PricingStrategy pricingStrategy) {
36-
* this.pricingStrategy = pricingStrategy;
37-
* }
3838
* }
3939
* </pre>
4040
* @author Ramnivas Laddad
4141
* @since 3.0.0
4242
*/
4343
public abstract aspect GenericInterfaceDrivenDependencyInjectionAspect<I> extends AbstractInterfaceDrivenDependencyInjectionAspect {
4444
declare parents: I implements ConfigurableObject;
45-
45+
4646
public pointcut inConfigurableBean() : within(I+);
47-
47+
4848
public final void configureBean(Object bean) {
4949
configure((I)bean);
5050
}
51-
52-
// Unfortunately, erasure used with generics won't allow to use the same named method
51+
52+
// Unfortunately, erasure used with generics won't allow to use the same named method
5353
protected abstract void configure(I bean);
5454
}

spring-aspects/src/main/java/org/springframework/cache/aspectj/AbstractCacheAspect.aj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public abstract aspect AbstractCacheAspect extends CacheAspectSupport {
6262
}
6363
};
6464

65-
return execute(aspectJInvoker, thisJoinPoint.getTarget(), method, thisJoinPoint.getArgs());
65+
return execute(aspectJInvoker, thisJoinPoint.getTarget(), method, thisJoinPoint.getArgs());
6666
}
6767

6868
/**

0 commit comments

Comments
 (0)