Example usage for org.aspectj.weaver.tools ShadowMatch neverMatches

List of usage examples for org.aspectj.weaver.tools ShadowMatch neverMatches

Introduction

In this page you can find the example usage for org.aspectj.weaver.tools ShadowMatch neverMatches.

Prototype

boolean neverMatches();

Source Link

Document

True iff the pointcut expression can never match any join point at this shadow (for example, the pointcut will never match a call to the given method).

Usage

From source file:org.springframework.aop.aspectj.AspectJExpressionPointcut.java

License:Apache License

@Override
public boolean matches(Method method, Class<?> targetClass, boolean beanHasIntroductions) {
    checkReadyToMatch();//from   w ww .  j  ava  2s . c om
    Method targetMethod = AopUtils.getMostSpecificMethod(method, targetClass);
    ShadowMatch shadowMatch = getShadowMatch(targetMethod, method);

    // Special handling for this, target, @this, @target, @annotation
    // in Spring - we can optimize since we know we have exactly this class,
    // and there will never be matching subclass at runtime.
    if (shadowMatch.alwaysMatches()) {
        return true;
    } else if (shadowMatch.neverMatches()) {
        return false;
    } else {
        // the maybe case
        if (beanHasIntroductions) {
            return true;
        }
        // A match test returned maybe - if there are any subtype sensitive variables
        // involved in the test (this, target, at_this, at_target, at_annotation) then
        // we say this is not a match as in Spring there will never be a different
        // runtime subtype.
        RuntimeTestWalker walker = getRuntimeTestWalker(shadowMatch);
        return (!walker.testsSubtypeSensitiveVars() || walker.testTargetInstanceOfResidue(targetClass));
    }
}