Package org.aspectj.weaver.ast

Examples of org.aspectj.weaver.ast.Var


   * @see org.aspectj.weaver.Shadow#getWithinAnnotationVar(org.aspectj.weaver.UnresolvedType)
   */
  public Var getWithinAnnotationVar(UnresolvedType forAnnotationType) {
    ResolvedType annType = forAnnotationType.resolve(world);
    if (withinAnnotationVar.get(annType) == null) {
      Var v = ReflectionVar.createWithinAnnotationVar(annType,this.annotationFinder);
      withinAnnotationVar.put(annType,v);
    }
    return (Var) withinAnnotationVar.get(annType);
  }
View Full Code Here


   * @see org.aspectj.weaver.Shadow#getWithinCodeAnnotationVar(org.aspectj.weaver.UnresolvedType)
   */
  public Var getWithinCodeAnnotationVar(UnresolvedType forAnnotationType) {
    ResolvedType annType = forAnnotationType.resolve(world);
    if (withinCodeAnnotationVar.get(annType) == null) {
      Var v = ReflectionVar.createWithinCodeAnnotationVar(annType,this.annotationFinder);
      withinCodeAnnotationVar.put(annType,v);
    }
    return (Var) withinCodeAnnotationVar.get(annType);
  }
View Full Code Here

   * we must have a TypeAnnotationAccessVar in place - this means we must *always* have one in place.
   */
  protected Test findResidueInternal(Shadow shadow, ExposedState state) {
      if (!couldMatch(shadow)) return Literal.FALSE;
      boolean alwaysMatches = match(shadow).alwaysTrue();
      Var var = isThis ? shadow.getThisVar() : shadow.getTargetVar();
      Var annVar = null;
     
      // Are annotations being bound?
      UnresolvedType annotationType = annotationTypePattern.annotationType;
    if (annotationTypePattern instanceof BindingAnnotationTypePattern) {
      BindingAnnotationTypePattern btp = (BindingAnnotationTypePattern)annotationTypePattern;
View Full Code Here

                    // in the call to residueSource.findResidue) to not be set (be null)
                    // in an Or pointcut with if expressions in both branches, and where
                    // one branch is known statically to not match. In this situation we
                    // simply return Test.
                    for (int i=0; i < baseArgsCount; i++) {
                        Var v = myState.get(i);
                        if (v == null) continue// pr118149
                        args.add(v);
                        ret = Test.makeAnd(ret,
                            Test.makeInstanceof(v,
                                testMethod.getParameterTypes()[i].resolve(shadow.getIWorld())));
                    }
                }

                // handle thisJoinPoint parameters
                if ((extraParameterFlags & Advice.ThisJoinPoint) != 0) {
                    args.add(shadow.getThisJoinPointVar());
                }

                if ((extraParameterFlags & Advice.ThisJoinPointStaticPart) != 0) {
                    args.add(shadow.getThisJoinPointStaticPartVar());
                }

                if ((extraParameterFlags & Advice.ThisEnclosingJoinPointStaticPart) != 0) {
                    args.add(shadow.getThisEnclosingJoinPointStaticPartVar());
                }
            } else {
                // @style is slightly different
                int currentStateIndex = 0;
                //FIXME AV - "args(jp)" test(jp, thejp) will fail here
                for (int i = 0; i < testMethod.getParameterTypes().length; i++) {
                    String argSignature = testMethod.getParameterTypes()[i].getSignature();
                    if (AjcMemberMaker.TYPEX_JOINPOINT.getSignature().equals(argSignature)) {
                        args.add(shadow.getThisJoinPointVar());
                    } else if (AjcMemberMaker.TYPEX_PROCEEDINGJOINPOINT.getSignature().equals(argSignature)) {
                        args.add(shadow.getThisJoinPointVar());
                    } else if (AjcMemberMaker.TYPEX_STATICJOINPOINT.getSignature().equals(argSignature)) {
                        args.add(shadow.getThisJoinPointStaticPartVar());
                    } else if (AjcMemberMaker.TYPEX_ENCLOSINGSTATICJOINPOINT.getSignature().equals(argSignature)) {
                        args.add(shadow.getThisEnclosingJoinPointStaticPartVar());
                    } else {
                        // we don't use i as JoinPoint.* can be anywhere in the signature in @style
                        Var v = state.get(currentStateIndex++);
                        args.add(v);
                        ret = Test.makeAnd(ret,
                            Test.makeInstanceof(v,
                                testMethod.getParameterTypes()[i].resolve(shadow.getIWorld())));
                    }
View Full Code Here

        if (!hasThis()) {
            throw new IllegalStateException("no this");
        }
        initializeThisAnnotationVars(); // FIXME asc Why bother with this if we always return one?
        // Even if we can't find one, we have to return one as we might have this annotation at runtime
        Var v = (Var) thisAnnotationVars.get(forAnnotationType);
      if (v==null)
        v = new TypeAnnotationAccessVar(forAnnotationType.resolve(world),(BcelVar)getThisVar());
        return v;
  }
View Full Code Here

    public Var getTargetAnnotationVar(UnresolvedType forAnnotationType) {
        if (!hasTarget()) {
            throw new IllegalStateException("no target");
        }
      initializeTargetAnnotationVars(); // FIXME asc why bother with this if we always return one?
      Var v  =(Var) targetAnnotationVars.get(forAnnotationType);
      // Even if we can't find one, we have to return one as we might have this annotation at runtime
      if (v==null)
        v = new TypeAnnotationAccessVar(forAnnotationType.resolve(world),(BcelVar)getTargetVar());
    return v;
   }
View Full Code Here

        return argVars[i];
   }
   public Var getArgAnnotationVar(int i,UnresolvedType forAnnotationType) {
    initializeArgAnnotationVars();
   
    Var v= (Var) argAnnotationVars[i].get(forAnnotationType);
    if (v==null)
          v = new TypeAnnotationAccessVar(forAnnotationType.resolve(world),(BcelVar)getArgVar(i));
    return v;
   }  
View Full Code Here

   */
  protected Test findResidueInternal(Shadow shadow, ExposedState state) {
    if (annotationTypePattern instanceof BindingAnnotationTypePattern) {
      BindingAnnotationTypePattern btp = (BindingAnnotationTypePattern)annotationTypePattern;
      UnresolvedType annotationType = btp.annotationType;
      Var var = shadow.getWithinAnnotationVar(annotationType);
     
      // This should not happen, we shouldn't have gotten this far
      // if we weren't going to find the annotation
      if (var == null)
        throw new BCException("Impossible! annotation=["+annotationType+
View Full Code Here

    if (!couldMatch(shadow)) return Literal.FALSE;
   
    // if no preference is specified, just say TRUE which means no residue
    if (type == TypePattern.ANY) return Literal.TRUE;
   
    Var var = isThis ? shadow.getThisVar() : shadow.getTargetVar()

    return exposeStateForVar(var, type, state, shadow.getIWorld());
  }
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.ast.Var

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.