Package org.aspectj.weaver.patterns

Examples of org.aspectj.weaver.patterns.Pointcut


    }
  }

  private void validateOrBranch(OrPointcut pc, Pointcut userPointcut, int numFormals, String[] names, Pointcut[] leftBindings,
      Pointcut[] rightBindings) {
    Pointcut left = pc.getLeft();
    Pointcut right = pc.getRight();
    if (left instanceof OrPointcut) {
      Pointcut[] newRightBindings = new Pointcut[numFormals];
      validateOrBranch((OrPointcut) left, userPointcut, numFormals, names, leftBindings, newRightBindings);
    } else {
      if (left.couldMatchKinds() != Shadow.NO_SHADOW_KINDS_BITS) {
        validateSingleBranch(left, userPointcut, numFormals, names, leftBindings);
      }
    }
    if (right instanceof OrPointcut) {
      Pointcut[] newLeftBindings = new Pointcut[numFormals];
      validateOrBranch((OrPointcut) right, userPointcut, numFormals, names, newLeftBindings, rightBindings);
    } else {
      if (right.couldMatchKinds() != Shadow.NO_SHADOW_KINDS_BITS) {
        validateSingleBranch(right, userPointcut, numFormals, names, rightBindings);
      }
    }
    int kindsInCommon = left.couldMatchKinds() & right.couldMatchKinds();
    if (kindsInCommon != Shadow.NO_SHADOW_KINDS_BITS && couldEverMatchSameJoinPoints(left, right)) {
      // we know that every branch binds every formal, so there is no
      // ambiguity
      // if each branch binds it in exactly the same way...
      List<String> ambiguousNames = new ArrayList<String>();
View Full Code Here


    if (toLookFor.isInstance(toSearch)) {
      return toSearch;
    }
    if (toSearch instanceof AndPointcut) {
      AndPointcut apc = (AndPointcut) toSearch;
      Pointcut left = findFirstPointcutIn(apc.getLeft(), toLookFor);
      if (left != null) {
        return left;
      }
      return findFirstPointcutIn(apc.getRight(), toLookFor);
    }
View Full Code Here

          ResolvedType declaringAspect = munger.getDeclaringType();
          if (typeWeaverState.isAspectAlreadyApplied(declaringAspect)) {
            continue;
          }
        }
        Pointcut pointcut = munger.getPointcut();
        long starttime = System.nanoTime();
        FuzzyBoolean fb = pointcut.fastMatch(info);
        long endtime = System.nanoTime();
        world.recordFastMatch(pointcut, endtime - starttime);
        if (fb.maybeTrue()) {
          result.add(munger);
        }
      }
    } else {
      for (ShadowMunger munger : list) {
        if (typeWeaverState != null) { // will only be null if overweaving is ON and there is weaverstate
          ResolvedType declaringAspect = munger.getConcreteAspect();// getDeclaringType();
          if (typeWeaverState.isAspectAlreadyApplied(declaringAspect)) {
            continue;
          }
        }
        Pointcut pointcut = munger.getPointcut();
        FuzzyBoolean fb = pointcut.fastMatch(info);
        if (fb.maybeTrue()) {
          result.add(munger);
        }
      }
    }
View Full Code Here

   * @param struct for which we are parsing the per clause
   * @return a PerClause instance
   */
  private static PerClause parsePerClausePointcut(String perClauseString, AjAttributeStruct struct) {
    final String pointcutString;
    Pointcut pointcut = null;
    TypePattern typePattern = null;
    final PerClause perClause;
    if (perClauseString.startsWith(PerClause.KindAnnotationPrefix.PERCFLOW.getName())) {
      pointcutString = PerClause.KindAnnotationPrefix.PERCFLOW.extractPointcut(perClauseString);
      pointcut = parsePointcut(pointcutString, struct, false);
View Full Code Here

        IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);

        // joinpoint, staticJoinpoint binding
        int extraArgument = extractExtraArgument(struct.method);

        Pointcut pc = null;
        if (preResolvedPointcut != null) {
          pc = preResolvedPointcut.getPointcut();
          // pc.resolve(binding);
        } else {
          pc = parsePointcut(beforeAdvice.getValue().stringifyValue(), struct, false);
          if (pc == null) {
            return false;// parse error
          }
          pc = pc.resolve(binding);
        }
        setIgnoreUnboundBindingNames(pc, bindings);

        ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(),
            struct.bMethod.getDeclarationOffset());
View Full Code Here

        IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);

        // joinpoint, staticJoinpoint binding
        int extraArgument = extractExtraArgument(struct.method);

        Pointcut pc = null;
        if (preResolvedPointcut != null) {
          pc = preResolvedPointcut.getPointcut();
        } else {
          pc = parsePointcut(afterAdvice.getValue().stringifyValue(), struct, false);
          if (pc == null) {
            return false;// parse error
          }
          pc.resolve(binding);
        }
        setIgnoreUnboundBindingNames(pc, bindings);

        ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(),
            struct.bMethod.getDeclarationOffset());
View Full Code Here

      // return binding
      if (returned != null) {
        extraArgument |= Advice.ExtraArgument;
      }

      Pointcut pc = null;
      if (preResolvedPointcut != null) {
        pc = preResolvedPointcut.getPointcut();
      } else {
        pc = parsePointcut(pointcut, struct, false);
        if (pc == null) {
          return false;// parse error
        }
        pc.resolve(binding);
      }
      setIgnoreUnboundBindingNames(pc, bindings);

      ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(),
          struct.bMethod.getDeclarationOffset());
View Full Code Here

      // return binding
      if (thrownFormal != null) {
        extraArgument |= Advice.ExtraArgument;
      }

      Pointcut pc = null;
      if (preResolvedPointcut != null) {
        pc = preResolvedPointcut.getPointcut();
      } else {
        pc = parsePointcut(pointcut, struct, false);
        if (pc == null) {
          return false;// parse error
        }
        pc.resolve(binding);
      }
      setIgnoreUnboundBindingNames(pc, bindings);

      ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(),
          struct.bMethod.getDeclarationOffset());
View Full Code Here

        IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);

        // joinpoint, staticJoinpoint binding
        int extraArgument = extractExtraArgument(struct.method);

        Pointcut pc = null;
        if (preResolvedPointcut != null) {
          pc = preResolvedPointcut.getPointcut();
        } else {
          pc = parsePointcut(aroundAdvice.getValue().stringifyValue(), struct, false);
          if (pc == null) {
            return false;// parse error
          }
          pc.resolve(binding);
        }
        setIgnoreUnboundBindingNames(pc, bindings);

        ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(),
            struct.bMethod.getDeclarationOffset());
View Full Code Here

    UnresolvedType[] argumentTypes = new UnresolvedType[struct.method.getArgumentTypes().length];
    for (int i = 0; i < argumentTypes.length; i++) {
      argumentTypes[i] = UnresolvedType.forSignature(struct.method.getArgumentTypes()[i].getSignature());
    }

    Pointcut pc = null;
    if (struct.method.isAbstract()) {
      if ((pointcutExpr != null && isNullOrEmpty(pointcutExpr.getValue().stringifyValue())) || pointcutExpr == null) {
        // abstract pointcut
        // leave pc = null
      } else {
        reportError("Found defined @Pointcut on an abstract method", struct);
        return false;// stop
      }
    } else {
      if (pointcutExpr == null || isNullOrEmpty(pointcutExpr.getValue().stringifyValue())) {
        // the matches nothing pointcut (125475/125480) - perhaps not as
        // cleanly supported as it could be.
      } else {
        // if (pointcutExpr != null) {
        // use a LazyResolvedPointcutDefinition so that the pointcut is
        // resolved lazily
        // since for it to be resolved, we will need other pointcuts to
        // be registered as well
        pc = parsePointcut(pointcutExpr.getValue().stringifyValue(), struct, true);
        if (pc == null) {
          return false;// parse error
        }
        pc.setLocation(struct.context, -1, -1);// FIXME AVASM !! bMethod
        // is null here..
        // } else {
        // reportError("Found undefined @Pointcut on a non-abstract method",
        // struct);
        // return false;
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.patterns.Pointcut

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.