37
37
import org .aspectj .weaver .tools .PointcutParser ;
38
38
import org .aspectj .weaver .tools .PointcutPrimitive ;
39
39
import org .aspectj .weaver .tools .ShadowMatch ;
40
+ import org .aspectj .weaver .tools .UnsupportedPointcutPrimitiveException ;
40
41
41
42
import org .springframework .aop .ClassFilter ;
42
43
import org .springframework .aop .IntroductionAwareMethodMatcher ;
@@ -111,6 +112,8 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
111
112
@ Nullable
112
113
private transient PointcutExpression pointcutExpression ;
113
114
115
+ private transient boolean pointcutParsingFailed = false ;
116
+
114
117
115
118
/**
116
119
* Create a new default AspectJExpressionPointcut.
@@ -264,6 +267,10 @@ public PointcutExpression getPointcutExpression() {
264
267
265
268
@ Override
266
269
public boolean matches (Class <?> targetClass ) {
270
+ if (this .pointcutParsingFailed ) {
271
+ return false ;
272
+ }
273
+
267
274
try {
268
275
try {
269
276
return obtainPointcutExpression ().couldMatchJoinPointsInType (targetClass );
@@ -277,8 +284,11 @@ public boolean matches(Class<?> targetClass) {
277
284
}
278
285
}
279
286
}
280
- catch (IllegalArgumentException | IllegalStateException ex ) {
281
- throw ex ;
287
+ catch (IllegalArgumentException | IllegalStateException | UnsupportedPointcutPrimitiveException ex ) {
288
+ this .pointcutParsingFailed = true ;
289
+ if (logger .isDebugEnabled ()) {
290
+ logger .debug ("Pointcut parser rejected expression [" + getExpression () + "]: " + ex );
291
+ }
282
292
}
283
293
catch (Throwable ex ) {
284
294
logger .debug ("PointcutExpression matching rejected target class" , ex );
0 commit comments