Skip to content

Commit b0790bf

Browse files
committed
Java 5 code style
1 parent 6bbc966 commit b0790bf

File tree

248 files changed

+2373
-3207
lines changed

Some content is hidden

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

248 files changed

+2373
-3207
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
public class AspectJExpressionPointcut extends AbstractExpressionPointcut
7575
implements ClassFilter, IntroductionAwareMethodMatcher, BeanFactoryAware {
7676

77-
private static final Set DEFAULT_SUPPORTED_PRIMITIVES = new HashSet();
77+
private static final Set<PointcutPrimitive> DEFAULT_SUPPORTED_PRIMITIVES = new HashSet<PointcutPrimitive>();
7878

7979
static {
8080
DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.EXECUTION);
@@ -92,7 +92,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
9292

9393
private static final Log logger = LogFactory.getLog(AspectJExpressionPointcut.class);
9494

95-
private final Map shadowMapCache = new HashMap();
95+
private final Map<Method, ShadowMatch> shadowMatchCache = new HashMap<Method, ShadowMatch>();
9696

9797
private PointcutParser pointcutParser;
9898

@@ -364,8 +364,8 @@ private void bindParameters(ProxyMethodInvocation invocation, JoinPointMatch jpm
364364
}
365365

366366
private ShadowMatch getShadowMatch(Method targetMethod, Method originalMethod) {
367-
synchronized (this.shadowMapCache) {
368-
ShadowMatch shadowMatch = (ShadowMatch) this.shadowMapCache.get(targetMethod);
367+
synchronized (this.shadowMatchCache) {
368+
ShadowMatch shadowMatch = this.shadowMatchCache.get(targetMethod);
369369
if (shadowMatch == null) {
370370
try {
371371
shadowMatch = this.pointcutExpression.matchesMethodExecution(targetMethod);
@@ -378,7 +378,7 @@ private ShadowMatch getShadowMatch(Method targetMethod, Method originalMethod) {
378378
}
379379
shadowMatch = this.pointcutExpression.matchesMethodExecution(originalMethod);
380380
}
381-
this.shadowMapCache.put(targetMethod, shadowMatch);
381+
this.shadowMatchCache.put(targetMethod, shadowMatch);
382382
}
383383
return shadowMatch;
384384
}
@@ -520,8 +520,8 @@ private boolean matchesBeanName(String advisedBeanName) {
520520
}
521521
if (beanFactory != null) {
522522
String[] aliases = beanFactory.getAliases(advisedBeanName);
523-
for (int i = 0; i < aliases.length; i++) {
524-
if (this.expressionPattern.matches(aliases[i])) {
523+
for (String alias : aliases) {
524+
if (this.expressionPattern.matches(alias)) {
525525
return true;
526526
}
527527
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2008 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.
@@ -48,7 +48,7 @@
4848
public class AspectJProxyFactory extends ProxyCreatorSupport {
4949

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

5353
private final AspectJAdvisorFactory aspectFactory = new ReflectiveAspectJAdvisorFactory();
5454

@@ -199,6 +199,7 @@ private Object getSingletonAspectInstance(Class aspectClass) {
199199
* (if necessary for proxy creation).
200200
* @return the new proxy
201201
*/
202+
@SuppressWarnings("unchecked")
202203
public <T> T getProxy() {
203204
return (T) createAopProxy().getProxy();
204205
}
@@ -211,6 +212,7 @@ public <T> T getProxy() {
211212
* @param classLoader the class loader to create the proxy with
212213
* @return the new proxy
213214
*/
215+
@SuppressWarnings("unchecked")
214216
public <T> T getProxy(ClassLoader classLoader) {
215217
return (T) createAopProxy().getProxy(classLoader);
216218
}

org.springframework.aop/src/main/java/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.java

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,17 @@ public void afterPropertiesSet() {
142142
ProxyFactory proxyFactory = new ProxyFactory();
143143

144144
if (this.preInterceptors != null) {
145-
for (int i = 0; i < this.preInterceptors.length; i++) {
146-
proxyFactory.addAdvisor(this.advisorAdapterRegistry.wrap(this.preInterceptors[i]));
145+
for (Object interceptor : this.preInterceptors) {
146+
proxyFactory.addAdvisor(this.advisorAdapterRegistry.wrap(interceptor));
147147
}
148148
}
149149

150150
// Add the main interceptor (typically an Advisor).
151151
proxyFactory.addAdvisor(this.advisorAdapterRegistry.wrap(createMainInterceptor()));
152152

153153
if (this.postInterceptors != null) {
154-
for (int i = 0; i < this.postInterceptors.length; i++) {
155-
proxyFactory.addAdvisor(this.advisorAdapterRegistry.wrap(this.postInterceptors[i]));
154+
for (Object interceptor : this.postInterceptors) {
155+
proxyFactory.addAdvisor(this.advisorAdapterRegistry.wrap(interceptor));
156156
}
157157
}
158158

@@ -170,7 +170,7 @@ else if (!isProxyTargetClass()) {
170170
ClassUtils.getAllInterfacesForClass(targetSource.getTargetClass(), this.proxyClassLoader));
171171
}
172172

173-
this.proxy = getProxy(proxyFactory);
173+
this.proxy = proxyFactory.getProxy(this.proxyClassLoader);
174174
}
175175

176176
/**
@@ -188,19 +188,6 @@ protected TargetSource createTargetSource(Object target) {
188188
}
189189
}
190190

191-
/**
192-
* Return the proxy object to expose.
193-
* <p>The default implementation uses a <code>getProxy</code> call with
194-
* the factory's bean class loader. Can be overridden to specify a
195-
* custom class loader.
196-
* @param aopProxy the prepared AopProxy instance to get the proxy from
197-
* @return the proxy object to expose
198-
* @see AopProxy#getProxy(ClassLoader)
199-
*/
200-
protected Object getProxy(AopProxy aopProxy) {
201-
return aopProxy.getProxy(this.proxyClassLoader);
202-
}
203-
204191

205192
public Object getObject() {
206193
if (this.proxy == null) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2008 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.
@@ -362,7 +362,7 @@ protected final void updateAdvisorArray() {
362362
* <p>Use with care, and remember to {@link #updateAdvisorArray() refresh the advisor array}
363363
* and {@link #adviceChanged() fire advice changed events} when making any modifications.
364364
*/
365-
protected final List getAdvisorsInternal() {
365+
protected final List<Advisor> getAdvisorsInternal() {
366366
return this.advisors;
367367
}
368368

@@ -454,7 +454,7 @@ public int countAdvicesOfType(Class adviceClass) {
454454
* @param targetClass the target class
455455
* @return List of MethodInterceptors (may also include InterceptorAndDynamicMethodMatchers)
456456
*/
457-
public List getInterceptorsAndDynamicInterceptionAdvice(Method method, Class targetClass) {
457+
public List<Object> getInterceptorsAndDynamicInterceptionAdvice(Method method, Class targetClass) {
458458
MethodCacheKey cacheKey = new MethodCacheKey(method);
459459
List<Object> cached = this.methodCache.get(cacheKey);
460460
if (cached == null) {

0 commit comments

Comments
 (0)