Package org.aspectj.weaver.patterns

Examples of org.aspectj.weaver.patterns.DeclareAnnotation


      }
    }

    // Still first pass - apply all dec @type mungers
    for (Iterator i = xcutSet.getDeclareAnnotationOnTypes().iterator();i.hasNext();) {
      DeclareAnnotation decA = (DeclareAnnotation)i.next();
      boolean typeChanged = applyDeclareAtType(decA,onType,true);
      if (typeChanged) {
        anAnnotationChangeOccurred = true;
      }
    }
   
    while ((aParentChangeOccurred || anAnnotationChangeOccurred) && !decpToRepeat.isEmpty()) {
      anAnnotationChangeOccurred = aParentChangeOccurred = false;
      List decpToRepeatNextTime = new ArrayList();
      for (Iterator iter = decpToRepeat.iterator(); iter.hasNext();) {
        DeclareParents decp = (DeclareParents) iter.next();
        boolean typeChanged = applyDeclareParents(decp,onType);
        if (typeChanged) {
          aParentChangeOccurred = true;
        } else {
          decpToRepeatNextTime.add(decp);
        }
      }
     
      for (Iterator iter = xcutSet.getDeclareAnnotationOnTypes().iterator(); iter.hasNext();) {
        DeclareAnnotation decA = (DeclareAnnotation) iter.next();
        boolean typeChanged = applyDeclareAtType(decA,onType,false);
        if (typeChanged) {
          anAnnotationChangeOccurred = true;
        }
      }
View Full Code Here


   * @see org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createDeclareAnnotationDeclaration(org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult, org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode, org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation, org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser)
   */
  public MethodDeclaration createDeclareAnnotationDeclaration(
      CompilationResult result, ASTNode pseudoTokens,
      Annotation annotation, Parser parser) {
    DeclareAnnotation declare = (DeclareAnnotation) ((PseudoTokens)pseudoTokens).parseAnnotationDeclare(parser);
    DeclareAnnotationDeclaration decl = new DeclareAnnotationDeclaration(result,declare,annotation);
    return decl;
  }
View Full Code Here

 
  public void addAtAspectJAnnotations() {
    Annotation annotation = null;
    if (declareDecl instanceof DeclareAnnotation) {
      DeclareAnnotation da = (DeclareAnnotation) declareDecl;
      String patternString = da.getPatternAsString();
      String annString = da.getAnnotationString();
      String kind = da.getKind().toString();
      annotation = AtAspectJAnnotationFactory.createDeclareAnnAnnotation(
              patternString,annString,kind,declarationSourceStart);
    } else if (declareDecl instanceof DeclareErrorOrWarning) {
      DeclareErrorOrWarning dd = (DeclareErrorOrWarning) declareDecl;
      annotation = AtAspectJAnnotationFactory
View Full Code Here

      m.pointcut = concretePointcut;
      declareSofts.add(new DeclareSoft(d.getException(), concretePointcut));
      addConcreteShadowMunger(m);
    } else if (declare instanceof DeclareAnnotation) {
        // FIXME asc perf Possible Improvement. Investigate why this is called twice in a weave ?
      DeclareAnnotation da = (DeclareAnnotation)declare;
      if (da.getAspect() == null) da.setAspect(this.inAspect);
      if (da.isDeclareAtType()) {
        declareAnnotationsOnType.add(da)
      } else if (da.isDeclareAtField()) {
        declareAnnotationsOnField.add(da);
      } else if (da.isDeclareAtMethod() || da.isDeclareAtConstuctor()) {
        declareAnnotationsOnMethods.add(da);
      }
    } else {
      throw new RuntimeException("unimplemented");
    }
View Full Code Here

        DeclarePrecedence ds = (DeclarePrecedence)declare.declareDecl;
        node.setName(name + DECLARE_PRECEDENCE);
        node.setDetails(genPrecedenceListLabel(ds.getPatterns()));
       
      } else if (declare.declareDecl instanceof DeclareAnnotation) {
          DeclareAnnotation deca = (DeclareAnnotation)declare.declareDecl;
        String thekind = deca.getKind().toString();
        node.setName(name+"@"+thekind.substring(3));

          if (deca.getKind()==DeclareAnnotation.AT_CONSTRUCTOR) {
            node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_CONSTRUCTOR);
          } else  if (deca.getKind()==DeclareAnnotation.AT_FIELD) {
            node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_FIELD);
          } else  if (deca.getKind()==DeclareAnnotation.AT_METHOD) {
            node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_METHOD);
          } else  if (deca.getKind()==DeclareAnnotation.AT_TYPE) {
            node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_TYPE);
          }
          node.setDetails(genDecaLabel(deca));
         
      } else {
View Full Code Here

        // the below loop fixes the very special (and very stupid)
        // case where an aspect declares an annotation
        // on an ITD it declared on itself.
        List allDecams = weaver.getWorld().getDeclareAnnotationOnMethods();
        for (Iterator i = allDecams.iterator(); i.hasNext();){
          DeclareAnnotation decaMC = (DeclareAnnotation) i.next()
          if (decaMC.matches(unMangledInterMethod,weaver.getWorld())
              && newMethod.getEnclosingClass().getType() == aspectType) {
            newMethod.addAnnotation(decaMC.getAnnotationX());
          }
        }
      }

      // If it doesn't target an interface and there is a body (i.e. it isnt abstract)
View Full Code Here

      // the below loop fixes the very special (and very stupid)
      // case where an aspect declares an annotation
      // on an ITD it declared on itself.
      List allDecams = weaver.getWorld().getDeclareAnnotationOnMethods();
      for (Iterator i = allDecams.iterator(); i.hasNext();){
        DeclareAnnotation decaMC = (DeclareAnnotation) i.next()
        if (decaMC.matches(explicitConstructor,weaver.getWorld())
            && mg.getEnclosingClass().getType() == aspectType) {
          mg.addAnnotation(decaMC.getAnnotationX());
        }
      }
    }
   
    currentClass.addMethodGen(mg);
View Full Code Here

        if (!decp.getChild().isStarAnnotation()) decpToRepeat.add(decp);
      }
    }

    for (Iterator i = declareAnnotationOnTypes.iterator(); i.hasNext();) {
      DeclareAnnotation deca = (DeclareAnnotation)i.next();
      boolean didSomething = doDeclareAnnotations(deca, sourceType,true);
      if (didSomething) {
        anyNewAnnotations = true;
      } else {
        if (!deca.getTypePattern().isStar()) decaToRepeat.add(deca);
      }
    }
   
        // now lets loop over and over until we have done all we can
    while ((anyNewAnnotations || anyNewParents) &&
        (!decpToRepeat.isEmpty() || !decaToRepeat.isEmpty())) {
      anyNewParents = anyNewAnnotations = false;
      List forRemoval = new ArrayList();
      for (Iterator i = decpToRepeat.iterator(); i.hasNext();) {
        DeclareParents decp = (DeclareParents)i.next();
        boolean didSomething = doDeclareParents(decp, sourceType);
        if (didSomething) {
          anyNewParents = true;
          forRemoval.add(decp);
        }
      }
      decpToRepeat.removeAll(forRemoval);

            forRemoval = new ArrayList();
      for (Iterator i = declareAnnotationOnTypes.iterator(); i.hasNext();) {
        DeclareAnnotation deca = (DeclareAnnotation)i.next();
        boolean didSomething = doDeclareAnnotations(deca, sourceType,false);
        if (didSomething) {
          anyNewAnnotations = true;
          forRemoval.add(deca);
        }
View Full Code Here

TOP

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

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.