Package org.aspectj.weaver.patterns

Examples of org.aspectj.weaver.patterns.DeclareSoft


    } else if (declare instanceof DeclareParents) {
      DeclareParents dp = (DeclareParents) declare;
      exposeTypes(dp.getParents().getExactTypes());
      declareParents.add(dp);
    } else if (declare instanceof DeclareSoft) {
      DeclareSoft d = (DeclareSoft) declare;
      // Ordered so that during concretization we can check the related
      // munger
      ShadowMunger m = Advice.makeSoftener(world, d.getPointcut(), d.getException(), inAspect, d);
      m.setDeclaringType(d.getDeclaringType());
      Pointcut concretePointcut = d.getPointcut().concretize(inAspect, d.getDeclaringType(), 0, m);
      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;
View Full Code Here


        }
        node.setDetails(kindOfDP + details.toString());

      } else if (declare.declareDecl instanceof DeclareSoft) {
        node.setKind(IProgramElement.Kind.DECLARE_SOFT);
        DeclareSoft ds = (DeclareSoft) declare.declareDecl;
        node.setName(name + AsmRelationshipUtils.DECLARE_SOFT);
        node.setDetails(genTypePatternLabel(ds.getException()));

      } else if (declare.declareDecl instanceof DeclarePrecedence) {
        node.setKind(IProgramElement.Kind.DECLARE_PRECEDENCE);
        DeclarePrecedence ds = (DeclarePrecedence) declare.declareDecl;
        node.setName(name + AsmRelationshipUtils.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));
View Full Code Here

      for (int i = 0; i < weaverTypePatterns.length; i++) {
        typePatterns.add(convert(weaverTypePatterns[i]));
      }
    } else if (declare instanceof DeclareSoft) {
      declareDeclaration = new DeclareSoftDeclaration(this.ast);
      DeclareSoft ds = (DeclareSoft) declare;
      ((DeclareSoftDeclaration) declareDeclaration).setPointcut(convert(ds.getPointcut()));
      org.aspectj.org.eclipse.jdt.core.dom.PatternNode pNode = convert(ds.getException());
      if (pNode instanceof org.aspectj.org.eclipse.jdt.core.dom.TypePattern) {
        ((DeclareSoftDeclaration) declareDeclaration)
            .setTypePattern((org.aspectj.org.eclipse.jdt.core.dom.TypePattern) pNode);
      }
    }
View Full Code Here

      }
      // System.err.println("about to show error for unhandled exception: " + new String(exceptionType.sourceName()) +
      // " at " + location + " in " + referenceContext);

      for (Iterator i = factory.getWorld().getDeclareSoft().iterator(); i.hasNext();) {
        DeclareSoft d = (DeclareSoft) i.next();
        // We need the exceptionType to match the type in the declare soft statement
        // This means it must either be the same type or a subtype
        ResolvedType throwException = factory.fromEclipse((ReferenceBinding) exceptionType);
        FuzzyBoolean isExceptionTypeOrSubtype = d.getException().matchesInstanceof(throwException);
        if (!isExceptionTypeOrSubtype.alwaysTrue())
          continue;

        if (callSite != null) {
          FuzzyBoolean match = d.getPointcut().match(callSite);
          if (match.alwaysTrue()) {
            // System.err.println("matched callSite: " + callSite + " with " + d);
            return;
          } else if (!match.alwaysFalse()) {
            // !!! need this check to happen much sooner
            // throw new RuntimeException("unimplemented, shouldn't have fuzzy match here");
          }
        }
        if (enclosingExec != null) {
          FuzzyBoolean match = d.getPointcut().match(enclosingExec);
          if (match.alwaysTrue()) {
            // System.err.println("matched enclosingExec: " + enclosingExec + " with " + d);
            return;
          } else if (!match.alwaysFalse()) {
            // !!! need this check to happen much sooner
View Full Code Here

    } else if (declareDecl instanceof DeclarePrecedence) {
      DeclarePrecedence dp = (DeclarePrecedence) declareDecl;
      String precedenceList = dp.getPatterns().toString();
      annotation = AtAspectJAnnotationFactory.createDeclarePrecedenceAnnotation(precedenceList, declarationSourceStart);
    } else if (declareDecl instanceof DeclareSoft) {
      DeclareSoft ds = (DeclareSoft) declareDecl;
      annotation = AtAspectJAnnotationFactory.createDeclareSoftAnnotation(ds.getPointcut().toString(), ds.getException()
          .getExactType().getName(), declarationSourceStart);
    }
    if (annotation != null) {
      AtAspectJAnnotationFactory.addAnnotation(this, annotation, this.scope);
    }
View Full Code Here

    } else if (declare instanceof DeclareParents) {
      DeclareParents dp = (DeclareParents) declare;
      exposeTypes(dp.getParents().getExactTypes());
      declareParents.add(dp);
    } else if (declare instanceof DeclareSoft) {
      DeclareSoft d = (DeclareSoft) declare;
      // Ordered so that during concretization we can check the related
      // munger
      ShadowMunger m = Advice.makeSoftener(world, d.getPointcut(), d.getException(), inAspect, d);
      m.setDeclaringType(d.getDeclaringType());
      Pointcut concretePointcut = d.getPointcut().concretize(inAspect, d.getDeclaringType(), 0, m);
      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;
View Full Code Here

    } else if (declare instanceof DeclareParents) {
      DeclareParents dp = (DeclareParents) declare;
      exposeTypes(dp.getParents().getExactTypes());
      declareParents.add(dp);
    } else if (declare instanceof DeclareSoft) {
      DeclareSoft d = (DeclareSoft) declare;
      // Ordered so that during concretization we can check the related
      // munger
      ShadowMunger m = Advice.makeSoftener(world, d.getPointcut(), d.getException(), inAspect, d);
      m.setDeclaringType(d.getDeclaringType());
      Pointcut concretePointcut = d.getPointcut().concretize(inAspect, d.getDeclaringType(), 0, m);
      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;
View Full Code Here

      }
//      System.err.println("about to show error for unhandled exception: "  + new String(exceptionType.sourceName()) +
//          " at " + location + " in " + referenceContext);   
     
      for (Iterator i = factory.getWorld().getDeclareSoft().iterator(); i.hasNext(); ) {
        DeclareSoft d = (DeclareSoft)i.next();
        // We need the exceptionType to match the type in the declare soft statement
        // This means it must either be the same type or a subtype
        ResolvedType throwException = factory.fromEclipse((ReferenceBinding)exceptionType);
        FuzzyBoolean isExceptionTypeOrSubtype =
          d.getException().matchesInstanceof(throwException);
        if (!isExceptionTypeOrSubtype.alwaysTrue() ) continue;

        if (callSite != null) {
          FuzzyBoolean match = d.getPointcut().match(callSite);
          if (match.alwaysTrue()) {
            //System.err.println("matched callSite: "  + callSite + " with " + d);
            return;
          } else if (!match.alwaysFalse()) {
            //!!! need this check to happen much sooner
            //throw new RuntimeException("unimplemented, shouldn't have fuzzy match here");
          }
        }
        if (enclosingExec != null) {
          FuzzyBoolean match = d.getPointcut().match(enclosingExec);
          if (match.alwaysTrue()) {
            //System.err.println("matched enclosingExec: "  + enclosingExec + " with " + d);
            return;
          } else if (!match.alwaysFalse()) {
            //!!! need this check to happen much sooner
View Full Code Here

    } else if (declareDecl instanceof DeclarePrecedence) {
      DeclarePrecedence dp = (DeclarePrecedence) declareDecl;
      String precedenceList = dp.getPatterns().toString();
      annotation = AtAspectJAnnotationFactory.createDeclarePrecedenceAnnotation(precedenceList,declarationSourceStart);
    } else if (declareDecl instanceof DeclareSoft) {
      DeclareSoft ds = (DeclareSoft) declareDecl;
      annotation = AtAspectJAnnotationFactory
        .createDeclareSoftAnnotation(ds.getPointcut().toString(),ds.getException().getExactType().getName(),declarationSourceStart);     
    }
    if (annotation != null) AtAspectJAnnotationFactory.addAnnotation(this,annotation,this.scope);
  }
View Full Code Here

    } else if (declare instanceof DeclareParents) {
      DeclareParents dp = (DeclareParents)declare;
      exposeTypes(dp.getParents().getExactTypes());
      declareParents.add(dp);
    } else if (declare instanceof DeclareSoft) {
      DeclareSoft d = (DeclareSoft)declare;
      // Ordered so that during concretization we can check the related munger
      ShadowMunger m = Advice.makeSoftener(world, d.getPointcut(), d.getException(),inAspect,d);
      m.setDeclaringType(d.getDeclaringType());
      Pointcut concretePointcut = d.getPointcut().concretize(inAspect, d.getDeclaringType(), 0,m);
      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);
View Full Code Here

TOP

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

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.