41
41
import org .aspectj .weaver .tools .PointcutParser ;
42
42
import org .aspectj .weaver .tools .PointcutPrimitive ;
43
43
import org .aspectj .weaver .tools .ShadowMatch ;
44
+ import org .aspectj .weaver .tools .UnsupportedPointcutPrimitiveException ;
44
45
45
46
import org .springframework .aop .ClassFilter ;
46
47
import org .springframework .aop .IntroductionAwareMethodMatcher ;
@@ -115,6 +116,8 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
115
116
@ Nullable
116
117
private transient PointcutExpression pointcutExpression ;
117
118
119
+ private transient boolean pointcutParsingFailed = false ;
120
+
118
121
private transient Map <Method , ShadowMatch > shadowMatchCache = new ConcurrentHashMap <>(32 );
119
122
120
123
@@ -270,6 +273,10 @@ public PointcutExpression getPointcutExpression() {
270
273
271
274
@ Override
272
275
public boolean matches (Class <?> targetClass ) {
276
+ if (this .pointcutParsingFailed ) {
277
+ return false ;
278
+ }
279
+
273
280
try {
274
281
try {
275
282
return obtainPointcutExpression ().couldMatchJoinPointsInType (targetClass );
@@ -283,8 +290,11 @@ public boolean matches(Class<?> targetClass) {
283
290
}
284
291
}
285
292
}
286
- catch (IllegalArgumentException | IllegalStateException ex ) {
287
- throw ex ;
293
+ catch (IllegalArgumentException | IllegalStateException | UnsupportedPointcutPrimitiveException ex ) {
294
+ this .pointcutParsingFailed = true ;
295
+ if (logger .isDebugEnabled ()) {
296
+ logger .debug ("Pointcut parser rejected expression [" + getExpression () + "]: " + ex );
297
+ }
288
298
}
289
299
catch (Throwable ex ) {
290
300
logger .debug ("PointcutExpression matching rejected target class" , ex );
0 commit comments