Package org.aspectj.weaver.patterns

Examples of org.aspectj.weaver.patterns.DeclareErrorOrWarning


    int deCtr = 1;
    int dwCtr = 1;
    for (Iterator iter = children.iterator(); iter.hasNext();) {
      Object element = iter.next();
      if (element instanceof DeclareErrorOrWarning) {
        DeclareErrorOrWarning decl = (DeclareErrorOrWarning) element;
        int counter = 0;
        if (decl.isError()) {
          counter = deCtr++;
        } else {
          counter = dwCtr++;
        }
        parent.addChild(createDeclareErrorOrWarningChild(asm, aspect, decl, counter));
View Full Code Here


    } else if (methodDeclaration instanceof DeclareDeclaration) {
      DeclareDeclaration declare = (DeclareDeclaration) methodDeclaration;
      String name = AsmRelationshipUtils.DEC_LABEL + " ";
      if (declare.declareDecl instanceof DeclareErrorOrWarning) {
        DeclareErrorOrWarning deow = (DeclareErrorOrWarning) declare.declareDecl;

        if (deow.isError()) {
          node.setKind(IProgramElement.Kind.DECLARE_ERROR);
          name += AsmRelationshipUtils.DECLARE_ERROR;
        } else {
          node.setKind(IProgramElement.Kind.DECLARE_WARNING);
          name += AsmRelationshipUtils.DECLARE_WARNING;
        }
        node.setName(name);
        node.setDetails("\"" + AsmRelationshipUtils.genDeclareMessage(deow.getMessage()) + "\"");

      } else if (declare.declareDecl instanceof DeclareParents) {

        node.setKind(IProgramElement.Kind.DECLARE_PARENTS);
        DeclareParents dp = (DeclareParents) declare.declareDecl;
View Full Code Here

            da.getAnnotationSourceEnd() - da.getAnnotationSourceStart());
        annotationName.internalSetIdentifier(da.getAnnotationString());
        ((DeclareAtMethodDeclaration) declareDeclaration).setAnnotationName(annotationName);
      }
    } else if (declare instanceof DeclareErrorOrWarning) {
      DeclareErrorOrWarning deow = (DeclareErrorOrWarning) declare;
      if (deow.isError()) {
        declareDeclaration = new DeclareErrorDeclaration(this.ast);
        ((DeclareErrorDeclaration) declareDeclaration).setPointcut(convert(deow.getPointcut()));
        StringLiteral message = new StringLiteral(this.ast);
        message.setEscapedValue(updateString(deow.getMessage()));
        ((DeclareErrorDeclaration) declareDeclaration).setMessage(message);
      } else {
        declareDeclaration = new DeclareWarningDeclaration(this.ast);
        ((DeclareWarningDeclaration) declareDeclaration).setPointcut(convert(deow.getPointcut()));
        StringLiteral message = new StringLiteral(this.ast);
        message.setEscapedValue(updateString(deow.getMessage()));
        ((DeclareWarningDeclaration) declareDeclaration).setMessage(message);
      }
    } else if (declare instanceof DeclareParents) {
      DeclareParents dp = (DeclareParents) declare;
      declareDeclaration = new org.aspectj.org.eclipse.jdt.core.dom.DeclareParentsDeclaration(this.ast, dp.isExtends());
View Full Code Here

        }
        Pointcut pc = parsePointcut(declareError.getValue().stringifyValue(), struct, false);
        if (pc == null) {
          hasError = false;// cannot parse pointcut
        } else {
          DeclareErrorOrWarning deow = new DeclareErrorOrWarning(true, pc, struct.field.getConstantValue().toString());
          setDeclareErrorOrWarningLocation(model, deow, struct);
          struct.ajAttributes.add(new AjAttribute.DeclareAttribute(deow));
          hasError = true;
        }
      }
    }
    AnnotationGen warning = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREWARNING_ANNOTATION);
    boolean hasWarning = false;
    if (warning != null) {
      NameValuePair declareWarning = getAnnotationElement(warning, VALUE);
      if (declareWarning != null) {
        if (!STRING_DESC.equals(struct.field.getSignature()) || struct.field.getConstantValue() == null) {
          reportError("@DeclareWarning used on a non String constant field", struct);
          return false;
        }
        Pointcut pc = parsePointcut(declareWarning.getValue().stringifyValue(), struct, false);
        if (pc == null) {
          hasWarning = false;// cannot parse pointcut
        } else {
          DeclareErrorOrWarning deow = new DeclareErrorOrWarning(false, pc, struct.field.getConstantValue().toString());
          setDeclareErrorOrWarningLocation(model, deow, struct);
          struct.ajAttributes.add(new AjAttribute.DeclareAttribute(deow));
          return hasWarning = true;
        }
      }
View Full Code Here

      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.createDeclareErrorOrWarningAnnotation(dd.getPointcut().toString(),
          dd.getMessage(), dd.isError(), declarationSourceStart);
    } else if (declareDecl instanceof DeclareParents) {
      DeclareParents dp = (DeclareParents) declareDecl;
      String childPattern = dp.getChild().toString();
      Collection parentPatterns = dp.getParents().getExactTypes();
      StringBuffer parents = new StringBuffer();
View Full Code Here

        }
        Pointcut pc = parsePointcut(declareError.getValue().stringifyValue(), struct, false);
        if (pc == null) {
          hasError = false;// cannot parse pointcut
        } else {
          DeclareErrorOrWarning deow = new DeclareErrorOrWarning(true, pc, struct.field.getConstantValue().toString());
          setDeclareErrorOrWarningLocation(model, deow, struct);
          struct.ajAttributes.add(new AjAttribute.DeclareAttribute(deow));
          hasError = true;
        }
      }
    }
    AnnotationGen warning = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREWARNING_ANNOTATION);
    boolean hasWarning = false;
    if (warning != null) {
      NameValuePair declareWarning = getAnnotationElement(warning, VALUE);
      if (declareWarning != null) {
        if (!STRING_DESC.equals(struct.field.getSignature()) || struct.field.getConstantValue() == null) {
          reportError("@DeclareWarning used on a non String constant field", struct);
          return false;
        }
        Pointcut pc = parsePointcut(declareWarning.getValue().stringifyValue(), struct, false);
        if (pc == null) {
          hasWarning = false;// cannot parse pointcut
        } else {
          DeclareErrorOrWarning deow = new DeclareErrorOrWarning(false, pc, struct.field.getConstantValue().toString());
          setDeclareErrorOrWarningLocation(model, deow, struct);
          struct.ajAttributes.add(new AjAttribute.DeclareAttribute(deow));
          return hasWarning = true;
        }
      }
View Full Code Here

  private static void addChildNodes(AsmManager asm, ResolvedType aspect, IProgramElement parent, Collection<?> children) {
    int deCtr = 1;
    int dwCtr = 1;
    for (Object element: children) {
      if (element instanceof DeclareErrorOrWarning) {
        DeclareErrorOrWarning decl = (DeclareErrorOrWarning) element;
        int counter = 0;
        if (decl.isError()) {
          counter = deCtr++;
        } else {
          counter = dwCtr++;
        }
        parent.addChild(createDeclareErrorOrWarningChild(asm, aspect, decl, counter));
View Full Code Here

        }
        Pointcut pc = parsePointcut(declareError.getValue().stringifyValue(), struct, false);
        if (pc == null) {
          hasError = false;// cannot parse pointcut
        } else {
          DeclareErrorOrWarning deow = new DeclareErrorOrWarning(true, pc, struct.field.getConstantValue().toString());
          setDeclareErrorOrWarningLocation(model, deow, struct);
          struct.ajAttributes.add(new AjAttribute.DeclareAttribute(deow));
          hasError = true;
        }
      }
    }
    AnnotationGen warning = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREWARNING_ANNOTATION);
    boolean hasWarning = false;
    if (warning != null) {
      NameValuePair declareWarning = getAnnotationElement(warning, VALUE);
      if (declareWarning != null) {
        if (!STRING_DESC.equals(struct.field.getSignature()) || struct.field.getConstantValue() == null) {
          reportError("@DeclareWarning used on a non String constant field", struct);
          return false;
        }
        Pointcut pc = parsePointcut(declareWarning.getValue().stringifyValue(), struct, false);
        if (pc == null) {
          hasWarning = false;// cannot parse pointcut
        } else {
          DeclareErrorOrWarning deow = new DeclareErrorOrWarning(false, pc, struct.field.getConstantValue().toString());
          setDeclareErrorOrWarningLocation(model, deow, struct);
          struct.ajAttributes.add(new AjAttribute.DeclareAttribute(deow));
          return hasWarning = true;
        }
      }
View Full Code Here

    int deCtr = 1;
    int dwCtr = 1;
    for (Iterator iter = children.iterator(); iter.hasNext();) {
      Object element = iter.next();
      if (element instanceof DeclareErrorOrWarning) {
        DeclareErrorOrWarning decl = (DeclareErrorOrWarning) element;
        int counter = 0;
        if (decl.isError()) {
          counter = deCtr++;
        } else {
          counter = dwCtr++;
        }
        parent.addChild(createDeclareErrorOrWarningChild(asm, aspect, decl, counter));
View Full Code Here

      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
                  .createDeclareErrorOrWarningAnnotation(dd.getPointcut().toString(),dd.getMessage(),dd.isError(),declarationSourceStart);
    } else if (declareDecl instanceof DeclareParents) {
      DeclareParents dp = (DeclareParents) declareDecl;
      String childPattern = dp.getChild().toString();
      Collection parentPatterns = dp.getParents().getExactTypes();
      StringBuffer parents = new StringBuffer();
View Full Code Here

TOP

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

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.