Skip to content

Commit e00fd52

Browse files
committed
Polishing
1 parent a159dd5 commit e00fd52

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

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

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
6060
private static final String AJC_MAGIC = "ajc$";
6161

6262
private static final Class<?>[] ASPECTJ_ANNOTATION_CLASSES = new Class<?>[] {
63-
Pointcut.class, Before.class, Around.class, After.class, AfterReturning.class, AfterThrowing.class};
63+
Pointcut.class, Around.class, Before.class, After.class, AfterReturning.class, AfterThrowing.class};
6464

6565

6666
/** Logger available to subclasses */
@@ -152,16 +152,12 @@ private static <A extends Annotation> AspectJAnnotation<A> findAnnotation(Method
152152

153153

154154
/**
155-
* AspectJ annotation types.
155+
* Enum for AspectJ annotation types.
156+
* @see AspectJAnnotation#getAnnotationType()
156157
*/
157158
protected enum AspectJAnnotationType {
158159

159-
AtPointcut,
160-
AtBefore,
161-
AtAfter,
162-
AtAfterReturning,
163-
AtAfterThrowing,
164-
AtAround
160+
AtPointcut, AtAround, AtBefore, AtAfter, AtAfterReturning, AtAfterThrowing
165161
}
166162

167163

@@ -177,11 +173,11 @@ protected static class AspectJAnnotation<A extends Annotation> {
177173

178174
static {
179175
annotationTypeMap.put(Pointcut.class, AspectJAnnotationType.AtPointcut);
176+
annotationTypeMap.put(Around.class, AspectJAnnotationType.AtAround);
180177
annotationTypeMap.put(Before.class, AspectJAnnotationType.AtBefore);
181178
annotationTypeMap.put(After.class, AspectJAnnotationType.AtAfter);
182179
annotationTypeMap.put(AfterReturning.class, AspectJAnnotationType.AtAfterReturning);
183180
annotationTypeMap.put(AfterThrowing.class, AspectJAnnotationType.AtAfterThrowing);
184-
annotationTypeMap.put(Around.class, AspectJAnnotationType.AtAround);
185181
}
186182

187183
private final A annotation;
@@ -195,8 +191,6 @@ protected static class AspectJAnnotation<A extends Annotation> {
195191
public AspectJAnnotation(A annotation) {
196192
this.annotation = annotation;
197193
this.annotationType = determineAnnotationType(annotation);
198-
// We know these methods exist with the same name on each object,
199-
// but need to invoke them reflectively as there isn't a common interface.
200194
try {
201195
this.pointcutExpression = resolveExpression(annotation);
202196
Object argNames = AnnotationUtils.getValue(annotation, "argNames");
@@ -267,11 +261,11 @@ public String[] getParameterNames(Method method) {
267261
if (annotation == null) {
268262
return null;
269263
}
270-
StringTokenizer strTok = new StringTokenizer(annotation.getArgumentNames(), ",");
271-
if (strTok.countTokens() > 0) {
272-
String[] names = new String[strTok.countTokens()];
264+
StringTokenizer nameTokens = new StringTokenizer(annotation.getArgumentNames(), ",");
265+
if (nameTokens.countTokens() > 0) {
266+
String[] names = new String[nameTokens.countTokens()];
273267
for (int i = 0; i < names.length; i++) {
274-
names[i] = strTok.nextToken();
268+
names[i] = nameTokens.nextToken();
275269
}
276270
return names;
277271
}

0 commit comments

Comments
 (0)