File tree 2 files changed +17
-8
lines changed
org.springframework.aop/src/main/java/org/springframework/aop/aspectj/annotation
2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -112,12 +112,11 @@ protected AbstractAspectJAdvisorFactory() {
112
112
* when compiled by ajc with the -1.5 flag, yet they cannot be consumed by Spring AOP.
113
113
*/
114
114
public boolean isAspect (Class <?> clazz ) {
115
- return (AjTypeSystem .getAjType (clazz ).isAspect () &&
116
- hasAspectAnnotation (clazz ) && !compiledByAjc (clazz ));
115
+ return (hasAspectAnnotation (clazz ) && !compiledByAjc (clazz ));
117
116
}
118
117
119
118
private boolean hasAspectAnnotation (Class <?> clazz ) {
120
- return clazz . isAnnotationPresent ( Aspect .class );
119
+ return ( AnnotationUtils . findAnnotation ( clazz , Aspect .class ) != null );
121
120
}
122
121
123
122
/**
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2006 the original author or authors.
2
+ * Copyright 2002-2009 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -67,13 +67,23 @@ public class AspectMetadata {
67
67
* @param aspectClass the aspect class
68
68
* @param aspectName the name of the aspect
69
69
*/
70
- public AspectMetadata (Class aspectClass , String aspectName ) {
70
+ public AspectMetadata (Class <?> aspectClass , String aspectName ) {
71
71
this .aspectName = aspectName ;
72
- this .ajType = AjTypeSystem .getAjType (aspectClass );
73
-
74
- if (!this .ajType .isAspect ()) {
72
+
73
+ Class <?> currClass = aspectClass ;
74
+ AjType ajType = null ;
75
+ while (!currClass .equals (Object .class )) {
76
+ AjType ajTypeToCheck = AjTypeSystem .getAjType (currClass );
77
+ if (ajTypeToCheck .isAspect ()) {
78
+ ajType = ajTypeToCheck ;
79
+ break ;
80
+ }
81
+ currClass = currClass .getSuperclass ();
82
+ }
83
+ if (ajType == null ) {
75
84
throw new IllegalArgumentException ("Class '" + aspectClass .getName () + "' is not an @AspectJ aspect" );
76
85
}
86
+ this .ajType = ajType ;
77
87
if (this .ajType .getDeclarePrecedence ().length > 0 ) {
78
88
throw new IllegalArgumentException ("DeclarePrecendence not presently supported in Spring AOP" );
79
89
}
You can’t perform that action at this time.
0 commit comments