Package org.aspectj.weaver.tools

Examples of org.aspectj.weaver.tools.ShadowMatch


    invocation.setUserAttribute(getExpression(), jpm);
  }

  private ShadowMatch getShadowMatch(Method targetMethod, Method originalMethod) {
    // Avoid lock contention for known Methods through concurrent access...
    ShadowMatch shadowMatch = this.shadowMatchCache.get(targetMethod);
    if (shadowMatch == null) {
      synchronized (this.shadowMatchCache) {
        // Not found - now check again with full lock...
        PointcutExpression fallbackExpression = null;
        Method methodToMatch = targetMethod;
        shadowMatch = this.shadowMatchCache.get(targetMethod);
        if (shadowMatch == null) {
          try {
            shadowMatch = this.pointcutExpression.matchesMethodExecution(methodToMatch);
          }
          catch (ReflectionWorldException ex) {
            // Failed to introspect target method, probably because it has been loaded
            // in a special ClassLoader. Let's try the declaring ClassLoader instead...
            try {
              fallbackExpression = getFallbackPointcutExpression(methodToMatch.getDeclaringClass());
              if (fallbackExpression != null) {
                shadowMatch = fallbackExpression.matchesMethodExecution(methodToMatch);
              }
            }
            catch (ReflectionWorldException ex2) {
              fallbackExpression = null;
            }
          }
          if (shadowMatch == null && targetMethod != originalMethod) {
            methodToMatch = originalMethod;
            try {
              shadowMatch = this.pointcutExpression.matchesMethodExecution(methodToMatch);
            }
            catch (ReflectionWorldException ex3) {
              // Could neither introspect the target class nor the proxy class ->
              // let's try the original method's declaring class before we give up...
              try {
                fallbackExpression = getFallbackPointcutExpression(methodToMatch.getDeclaringClass());
                if (fallbackExpression != null) {
                  shadowMatch = fallbackExpression.matchesMethodExecution(methodToMatch);
                }
              }
              catch (ReflectionWorldException ex4) {
                fallbackExpression = null;
              }
            }
          }
          if (shadowMatch == null) {
            shadowMatch = new ShadowMatchImpl(org.aspectj.util.FuzzyBoolean.NO, null, null, null);
          }
          else if (shadowMatch.maybeMatches() && fallbackExpression != null) {
            shadowMatch = new DefensiveShadowMatch(shadowMatch,
                fallbackExpression.matchesMethodExecution(methodToMatch));
          }
          this.shadowMatchCache.put(targetMethod, shadowMatch);
        }
View Full Code Here


  }

  public boolean matches(Method method, Class targetClass, boolean beanHasIntroductions) {
    checkReadyToMatch();
    Method targetMethod = AopUtils.getMostSpecificMethod(method, targetClass);
    ShadowMatch shadowMatch = null;
    try {
      shadowMatch = getShadowMatch(targetMethod, method);
    }
    catch (ReflectionWorld.ReflectionWorldException ex) {
      // Could neither introspect the target class nor the proxy class ->
      // let's simply consider this method as non-matching.
      return false;
    }

    // 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
      return (beanHasIntroductions || matchesIgnoringSubtypes(shadowMatch) || matchesTarget(shadowMatch, targetClass));
View Full Code Here

    return this.pointcutExpression.mayNeedDynamicTest();
  }

  public boolean matches(Method method, Class targetClass, Object[] args) {
    checkReadyToMatch();
    ShadowMatch shadowMatch = null;
    ShadowMatch originalShadowMatch = null;
    try {
      shadowMatch = getShadowMatch(AopUtils.getMostSpecificMethod(method, targetClass), method);
      originalShadowMatch = getShadowMatch(method, method);
    }
    catch (ReflectionWorld.ReflectionWorldException ex) {
View Full Code Here

    invocation.setUserAttribute(getExpression(), jpm);
  }

  private ShadowMatch getShadowMatch(Method targetMethod, Method originalMethod) {
    synchronized (this.shadowMapCache) {
      ShadowMatch shadowMatch = (ShadowMatch) this.shadowMapCache.get(targetMethod);
      if (shadowMatch == null) {
        try {
          shadowMatch = this.pointcutExpression.matchesMethodExecution(targetMethod);
        }
        catch (ReflectionWorld.ReflectionWorldException ex) {
View Full Code Here

  }

  public boolean matches(Method method, Class targetClass, boolean beanHasIntroductions) {
    checkReadyToMatch();
    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
      return (beanHasIntroductions || matchesIgnoringSubtypes(shadowMatch) || matchesTarget(shadowMatch, targetClass));
View Full Code Here

    return this.pointcutExpression.mayNeedDynamicTest();
  }

  public boolean matches(Method method, Class targetClass, Object[] args) {
    checkReadyToMatch();
    ShadowMatch shadowMatch = getShadowMatch(AopUtils.getMostSpecificMethod(method, targetClass), method);
    ShadowMatch originalShadowMatch = getShadowMatch(method, method);

    // Bind Spring AOP proxy to AspectJ "this" and Spring AOP target to AspectJ target,
    // consistent with return of MethodInvocationProceedingJoinPoint
    ProxyMethodInvocation pmi = null;
    Object targetObject = null;
View Full Code Here

    invocation.setUserAttribute(getExpression(), jpm);
  }

  private ShadowMatch getShadowMatch(Method targetMethod, Method originalMethod) {
    // Avoid lock contention for known Methods through concurrent access...
    ShadowMatch shadowMatch = this.shadowMatchCache.get(targetMethod);
    if (shadowMatch == null) {
      synchronized (this.shadowMatchCache) {
        // Not found - now check again with full lock...
        shadowMatch = this.shadowMatchCache.get(targetMethod);
        if (shadowMatch == null) {
View Full Code Here

  }

  public boolean matches(Method method, Class<?> targetClass, Object... args) {
    checkReadyToMatch();
//    ShadowMatch shadowMatch = null;
    ShadowMatch originalShadowMatch = null;
    try {
      //shadowMatch = getShadowMatch(AopUtils.getMostSpecificMethod(method, targetClass), method);
      originalShadowMatch = getShadowMatch(method, method);
      if (originalShadowMatch.alwaysMatches())
        return true;
      else
        return matchesByMethodMatcher(method, targetClass, args);
       
    }
View Full Code Here

    return false;
  }
 
  private ShadowMatch getShadowMatch(Method targetMethod, Method originalMethod) {
    synchronized (this.shadowMapCache) {
      ShadowMatch shadowMatch = (ShadowMatch) this.shadowMapCache.get(targetMethod);
      if (shadowMatch == null) {
        try {
          shadowMatch = this.pointcutExpression.matchesMethodExecution(targetMethod);
        }
        catch (ReflectionWorld.ReflectionWorldException ex) {
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.tools.ShadowMatch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.