Package org.aspectj.weaver

Examples of org.aspectj.weaver.ShadowMunger


  }

  private boolean checkLazyTjp() {
    // check for around advice
    for (Iterator i = mungers.iterator(); i.hasNext();) {
      ShadowMunger munger = (ShadowMunger) i.next();
      if (munger instanceof Advice) {
        if (((Advice) munger).getKind() == AdviceKind.Around) {
          if (munger.getSourceLocation() != null) { // do we know enough to bother reporting?
            if (world.getLint().canNotImplementLazyTjp.isEnabled()) {
              world.getLint().canNotImplementLazyTjp.signal(new String[] { toString() }, getSourceLocation(),
                  new ISourceLocation[] { munger.getSourceLocation() });
            }
          }
          return false;
        }
      }
View Full Code Here


  @Override
  public ShadowMunger concretize(ResolvedType fromType, World world, PerClause clause) {
    if (!world.areAllLintIgnored()) {
      suppressLintWarnings(world);
    }
    ShadowMunger ret = super.concretize(fromType, world, clause);
    if (!world.areAllLintIgnored()) {
      clearLintSuppressions(world, this.suppressedLintKinds);
    }
    IfFinder ifinder = new IfFinder();
    ret.getPointcut().accept(ifinder, null);
    boolean hasGuardTest = ifinder.hasIf && getKind() != AdviceKind.Around;
    boolean isAround = getKind() == AdviceKind.Around;
    if ((getExtraParameterFlags() & ThisJoinPoint) != 0) {
      if (!isAround && !hasGuardTest && world.getLint().noGuardForLazyTjp.isEnabled()) {
        // can't build tjp lazily, no suitable test...
View Full Code Here

          this.getSourceLocation(), null);
      return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
    }

    if (bindings.directlyInAdvice()) {
      ShadowMunger advice = bindings.getEnclosingAdvice();
      if (advice instanceof Advice) {
        ret.baseArgsCount = ((Advice) advice).getBaseParameterCount();
      } else {
        ret.baseArgsCount = 0;
      }
      ret.residueSource = advice.getPointcut().concretize(inAspect, inAspect, ret.baseArgsCount, advice);
    } else {
      ResolvedPointcutDefinition def = bindings.peekEnclosingDefinition();
      if (def == CflowPointcut.CFLOW_MARKER) {
        inAspect.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.IF_LEXICALLY_IN_CFLOW),
            getSourceLocation(), null);
View Full Code Here

    // across the set of pointcuts....
    // Use a map from key based on pc equality, to value based on
    // pc identity.
    Map/* <Pointcut,Pointcut> */<Pointcut, Pointcut> pcMap = new HashMap<Pointcut, Pointcut>();
    for (Iterator iter = shadowMungers.iterator(); iter.hasNext();) {
      ShadowMunger munger = (ShadowMunger) iter.next();
      Pointcut p = munger.getPointcut();
      Pointcut newP = shareEntriesFromMap(p, pcMap);
      newP.m_ignoreUnboundBindingForNames = p.m_ignoreUnboundBindingForNames;
      munger.setPointcut(newP);
    }
  }
View Full Code Here

    if (world.isInJava5Mode() && world.getLint().adviceDidNotMatch.isEnabled()) {
      List l = world.getCrosscuttingMembersSet().getShadowMungers();
      Set<AdviceLocation> alreadyWarnedLocations = new HashSet<AdviceLocation>();

      for (Iterator iter = l.iterator(); iter.hasNext();) {
        ShadowMunger element = (ShadowMunger) iter.next();
        // This will stop us incorrectly reporting deow checkers:
        if (element instanceof BcelAdvice) {
          BcelAdvice ba = (BcelAdvice) element;
          if (ba.getKind() == AdviceKind.CflowEntry || ba.getKind() == AdviceKind.CflowBelowEntry) {
            continue;
          }
          if (!ba.hasMatchedSomething()) {
            // Because we implement some features of AJ itself by
            // creating our own kind of mungers, you sometimes
            // find that ba.getSignature() is not a BcelMethod - for
            // example it might be a cflow entry munger.
            if (ba.getSignature() != null) {
              // check we haven't already warned on this advice and line
              // (cflow creates multiple mungers for the same advice)
              AdviceLocation loc = new AdviceLocation(ba);
              if (alreadyWarnedLocations.contains(loc)) {
                continue;
              } else {
                alreadyWarnedLocations.add(loc);
              }

              if (!(ba.getSignature() instanceof BcelMethod)
                  || !Utility.isSuppressing(ba.getSignature(), "adviceDidNotMatch")) {
                world.getLint().adviceDidNotMatch.signal(ba.getDeclaringAspect().toString(), new SourceLocation(
                    element.getSourceLocation().getSourceFile(), element.getSourceLocation().getLine()));
              }
            }
          }
        }
      }
View Full Code Here

  @Override
  public ShadowMunger concretize(ResolvedType fromType, World world, PerClause clause) {
    if (!world.areAllLintIgnored()) {
      suppressLintWarnings(world);
    }
    ShadowMunger ret = super.concretize(fromType, world, clause);
    if (!world.areAllLintIgnored()) {
      clearLintSuppressions(world, this.suppressedLintKinds);
    }
    IfFinder ifinder = new IfFinder();
    ret.getPointcut().accept(ifinder, null);
    boolean hasGuardTest = ifinder.hasIf && getKind() != AdviceKind.Around;
    boolean isAround = getKind() == AdviceKind.Around;
    if ((getExtraParameterFlags() & ThisJoinPoint) != 0) {
      if (!isAround && !hasGuardTest && world.getLint().noGuardForLazyTjp.isEnabled()) {
        // can't build tjp lazily, no suitable test...
View Full Code Here

        }
      }

      if (pointcutDec.isAbstract()) {
        // Thread.currentThread().dumpStack();
        ShadowMunger enclosingAdvice = bindings.getEnclosingAdvice();
        searchStart.getWorld().showMessage(IMessage.ERROR,
            WeaverMessages.format(WeaverMessages.ABSTRACT_POINTCUT, pointcutDec), getSourceLocation(),
            (null == enclosingAdvice) ? null : enclosingAdvice.getSourceLocation());
        return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
      }

      // System.err.println("start: " + searchStart);
      // ResolvedType[] parameterTypes = searchStart.getWorld().resolve(pointcutDec.getParameterTypes());
View Full Code Here

          this.getSourceLocation(), null);
      return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
    }

    if (bindings.directlyInAdvice()) {
      ShadowMunger advice = bindings.getEnclosingAdvice();
      if (advice instanceof Advice) {
        ret.baseArgsCount = ((Advice) advice).getBaseParameterCount();
      } else {
        ret.baseArgsCount = 0;
      }
      ret.residueSource = advice.getPointcut().concretize(inAspect, inAspect, ret.baseArgsCount, advice);
    } else {
      ResolvedPointcutDefinition def = bindings.peekEnclosingDefinition();
      if (def == CflowPointcut.CFLOW_MARKER) {
        inAspect.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.IF_LEXICALLY_IN_CFLOW),
            getSourceLocation(), null);
View Full Code Here

    // across the set of pointcuts....
    // Use a map from key based on pc equality, to value based on
    // pc identity.
    Map/* <Pointcut,Pointcut> */<Pointcut, Pointcut> pcMap = new HashMap<Pointcut, Pointcut>();
    for (Iterator iter = shadowMungers.iterator(); iter.hasNext();) {
      ShadowMunger munger = (ShadowMunger) iter.next();
      Pointcut p = munger.getPointcut();
      Pointcut newP = shareEntriesFromMap(p, pcMap);
      newP.m_ignoreUnboundBindingForNames = p.m_ignoreUnboundBindingForNames;
      munger.setPointcut(newP);
    }
  }
View Full Code Here

    if (world.isInJava5Mode() && world.getLint().adviceDidNotMatch.isEnabled()) {
      List l = world.getCrosscuttingMembersSet().getShadowMungers();
      Set<AdviceLocation> alreadyWarnedLocations = new HashSet<AdviceLocation>();

      for (Iterator iter = l.iterator(); iter.hasNext();) {
        ShadowMunger element = (ShadowMunger) iter.next();
        // This will stop us incorrectly reporting deow checkers:
        if (element instanceof BcelAdvice) {
          BcelAdvice ba = (BcelAdvice) element;
          if (ba.getKind() == AdviceKind.CflowEntry || ba.getKind() == AdviceKind.CflowBelowEntry) {
            continue;
          }
          if (!ba.hasMatchedSomething()) {
            // Because we implement some features of AJ itself by
            // creating our own kind of mungers, you sometimes
            // find that ba.getSignature() is not a BcelMethod - for
            // example it might be a cflow entry munger.
            if (ba.getSignature() != null) {
              // check we haven't already warned on this advice and line
              // (cflow creates multiple mungers for the same advice)
              AdviceLocation loc = new AdviceLocation(ba);
              if (alreadyWarnedLocations.contains(loc)) {
                continue;
              } else {
                alreadyWarnedLocations.add(loc);
              }

              if (!(ba.getSignature() instanceof BcelMethod)
                  || !Utility.isSuppressing(ba.getSignature(), "adviceDidNotMatch")) {
                world.getLint().adviceDidNotMatch.signal(ba.getDeclaringAspect().toString(), new SourceLocation(
                    element.getSourceLocation().getSourceFile(), element.getSourceLocation().getLine()));
              }
            }
          }
        }
      }
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.ShadowMunger

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.