Skip to content

Commit 4b30fe2

Browse files
committed
Polishing
1 parent e94c691 commit 4b30fe2

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 */
@@ -150,16 +150,12 @@ private static <A extends Annotation> AspectJAnnotation<A> findAnnotation(Method
150150

151151

152152
/**
153-
* AspectJ annotation types.
153+
* Enum for AspectJ annotation types.
154+
* @see AspectJAnnotation#getAnnotationType()
154155
*/
155156
protected enum AspectJAnnotationType {
156157

157-
AtPointcut,
158-
AtBefore,
159-
AtAfter,
160-
AtAfterReturning,
161-
AtAfterThrowing,
162-
AtAround
158+
AtPointcut, AtAround, AtBefore, AtAfter, AtAfterReturning, AtAfterThrowing
163159
}
164160

165161

@@ -176,11 +172,11 @@ protected static class AspectJAnnotation<A extends Annotation> {
176172

177173
static {
178174
annotationTypeMap.put(Pointcut.class, AspectJAnnotationType.AtPointcut);
175+
annotationTypeMap.put(Around.class, AspectJAnnotationType.AtAround);
179176
annotationTypeMap.put(Before.class, AspectJAnnotationType.AtBefore);
180177
annotationTypeMap.put(After.class, AspectJAnnotationType.AtAfter);
181178
annotationTypeMap.put(AfterReturning.class, AspectJAnnotationType.AtAfterReturning);
182179
annotationTypeMap.put(AfterThrowing.class, AspectJAnnotationType.AtAfterThrowing);
183-
annotationTypeMap.put(Around.class, AspectJAnnotationType.AtAround);
184180
}
185181

186182
private final A annotation;
@@ -194,8 +190,6 @@ protected static class AspectJAnnotation<A extends Annotation> {
194190
public AspectJAnnotation(A annotation) {
195191
this.annotation = annotation;
196192
this.annotationType = determineAnnotationType(annotation);
197-
// We know these methods exist with the same name on each object,
198-
// but need to invoke them reflectively as there isn't a common interface.
199193
try {
200194
this.pointcutExpression = resolveExpression(annotation);
201195
this.argumentNames = (String) AnnotationUtils.getValue(annotation, "argNames");
@@ -261,11 +255,11 @@ public String[] getParameterNames(Method method) {
261255
if (annotation == null) {
262256
return null;
263257
}
264-
StringTokenizer strTok = new StringTokenizer(annotation.getArgumentNames(), ",");
265-
if (strTok.countTokens() > 0) {
266-
String[] names = new String[strTok.countTokens()];
258+
StringTokenizer nameTokens = new StringTokenizer(annotation.getArgumentNames(), ",");
259+
if (nameTokens.countTokens() > 0) {
260+
String[] names = new String[nameTokens.countTokens()];
267261
for (int i = 0; i < names.length; i++) {
268-
names[i] = strTok.nextToken();
262+
names[i] = nameTokens.nextToken();
269263
}
270264
return names;
271265
}

0 commit comments

Comments
 (0)