Package org.aspectj.weaver

Examples of org.aspectj.weaver.ResolvedTypeMunger


   * Half baked implementation - will need completing if we go down this route rather than replacing it all for binary aspects.
   * Doesn't attempt to get parameter names correct - they may have been lost during (de)serialization of the munger, but the
   * member could still be located so they might be retrievable.
   */
  private static IProgramElement createIntertypeDeclaredChild(AsmManager model, ResolvedType aspect, BcelTypeMunger itd) {
    ResolvedTypeMunger rtMunger = itd.getMunger();

    ResolvedMember sig = rtMunger.getSignature();
    Kind kind = rtMunger.getKind();
    if (kind == ResolvedTypeMunger.Field) { // ITD FIELD
      // String name = rtMunger.getSignature().toString();
      String name = sig.getDeclaringType().getClassName() + "." + sig.getName();
      if (name.indexOf("$") != -1) {
        name = name.substring(name.indexOf("$") + 1);
      }
      IProgramElement pe = new ProgramElement(model, name, IProgramElement.Kind.INTER_TYPE_FIELD, getBinarySourceLocation(
          aspect, itd.getSourceLocation()), rtMunger.getSignature().getModifiers(), null, Collections.EMPTY_LIST);
      pe.setCorrespondingType(sig.getReturnType().getName());
      return pe;
    } else if (kind == ResolvedTypeMunger.Method) { // ITD
      // METHOD
      String name = sig.getDeclaringType().getClassName() + "." + sig.getName();
      if (name.indexOf("$") != -1) {
        name = name.substring(name.indexOf("$") + 1);
      }
      IProgramElement pe = new ProgramElement(model, name, IProgramElement.Kind.INTER_TYPE_METHOD, getBinarySourceLocation(
          aspect, itd.getSourceLocation()), rtMunger.getSignature().getModifiers(), null, Collections.EMPTY_LIST);
      setParams(pe, sig);
      return pe;
    } else if (kind == ResolvedTypeMunger.Constructor) {
      String name = sig.getDeclaringType().getClassName() + "." + sig.getDeclaringType().getClassName();
      if (name.indexOf("$") != -1) {
        name = name.substring(name.indexOf("$") + 1);
      }
      IProgramElement pe = new ProgramElement(model, name, IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR,
          getBinarySourceLocation(aspect, itd.getSourceLocation()), rtMunger.getSignature().getModifiers(), null,
          Collections.EMPTY_LIST);
      setParams(pe, sig);
      return pe;
      // } else if (kind == ResolvedTypeMunger.MethodDelegate2) {
      // String name = sig.getDeclaringType().getClassName() + "." + sig.getName();
View Full Code Here


        // itself
        // (like transform super calls) - that is done in
        // BcelTypeMunger.mungeNewParent()
        // classType.addParent(newParent);
        onType.addParent(newParent);
        ResolvedTypeMunger newParentMunger = new NewParentTypeMunger(newParent, p.getDeclaringType());
        newParentMunger.setSourceLocation(p.getSourceLocation());
        onType.addInterTypeMunger(new BcelTypeMunger(newParentMunger, getCrosscuttingMembersSet()
            .findAspectDeclaringParents(p)), false);
      }
    }
    return didSomething;
View Full Code Here

      // check the annotation is suitable for the target
      boolean isOK = checkTargetOK(decA, onType, annoX);

      if (isOK) {
        didSomething = true;
        ResolvedTypeMunger newAnnotationTM = new AnnotationOnTypeMunger(annoX);
        newAnnotationTM.setSourceLocation(decA.getSourceLocation());
        onType.addInterTypeMunger(new BcelTypeMunger(newAnnotationTM, decA.getAspect().resolve(this)), false);
        decA.copyAnnotationTo(onType);
      }
    }
    return didSomething;
View Full Code Here

    return null;
  }

  // FIXME asc refactor this to neaten it up
  public LazyMethodGen locateAnnotationHolderForMethodCtorMunger(LazyClassGen clazz, ConcreteTypeMunger methodCtorMunger) {
    ResolvedTypeMunger rtMunger = methodCtorMunger.getMunger();
    ResolvedMember lookingFor = null;
    if (rtMunger instanceof NewMethodTypeMunger) {
      NewMethodTypeMunger nftm = (NewMethodTypeMunger) rtMunger;
      lookingFor = AjcMemberMaker.interMethodDispatcher(nftm.getSignature(), methodCtorMunger.getAspectType());
    } else if (rtMunger instanceof NewConstructorTypeMunger) {
View Full Code Here

                  new String[] { onType.toString(), Utility.beautifyLocation(onType.getSourceLocation()),
                      decA.getAnnotationString(), "type", decA.getAspect().toString(),
                      Utility.beautifyLocation(decA.getSourceLocation()) }));
        }
        didSomething = true;
        ResolvedTypeMunger newAnnotationTM = new AnnotationOnTypeMunger(annoX);
        newAnnotationTM.setSourceLocation(decA.getSourceLocation());
        onType.addInterTypeMunger(new BcelTypeMunger(newAnnotationTM, decA.getAspect().resolve(world)), false);
        decA.copyAnnotationTo(onType);
      }
    }
    return didSomething;
View Full Code Here

    return null;
  }

  // FIXME asc refactor this to neaten it up
  public LazyMethodGen locateAnnotationHolderForMethodCtorMunger(LazyClassGen clazz, ConcreteTypeMunger methodCtorMunger) {
    ResolvedTypeMunger rtMunger = methodCtorMunger.getMunger();
    ResolvedMember lookingFor = null;
    if (rtMunger instanceof NewMethodTypeMunger) {
      NewMethodTypeMunger nftm = (NewMethodTypeMunger) rtMunger;
      lookingFor = AjcMemberMaker.interMethodDispatcher(nftm.getSignature(), methodCtorMunger.getAspectType());
    } else if (rtMunger instanceof NewConstructorTypeMunger) {
View Full Code Here

        // itself
        // (like transform super calls) - that is done in
        // BcelTypeMunger.mungeNewParent()
        // classType.addParent(newParent);
        onType.addParent(newParent);
        ResolvedTypeMunger newParentMunger = new NewParentTypeMunger(newParent, p.getDeclaringType());
        newParentMunger.setSourceLocation(p.getSourceLocation());
        onType.addInterTypeMunger(new BcelTypeMunger(newParentMunger, getCrosscuttingMembersSet()
            .findAspectDeclaringParents(p)), false);
      }
    }
    return didSomething;
View Full Code Here

      // check the annotation is suitable for the target
      boolean isOK = checkTargetOK(decA, onType, annoX);

      if (isOK) {
        didSomething = true;
        ResolvedTypeMunger newAnnotationTM = new AnnotationOnTypeMunger(annoX);
        newAnnotationTM.setSourceLocation(decA.getSourceLocation());
        onType.addInterTypeMunger(new BcelTypeMunger(newAnnotationTM, decA.getAspect().resolve(this)), false);
        decA.copyAnnotationTo(onType);
      }
    }
    return didSomething;
View Full Code Here

    // This munger will initialize the aspect instance field in the matched
    // type

    inAspect.crosscuttingMembers.addConcreteShadowMunger(Advice.makePerTypeWithinEntry(world, andPcut, inAspect));

    ResolvedTypeMunger munger = new PerTypeWithinTargetTypeMunger(inAspect, ret);
    inAspect.crosscuttingMembers.addTypeMunger(world.getWeavingSupport().concreteTypeMunger(munger, inAspect));

    // ATAJ: add a munger to add the aspectOf(..) to the @AJ aspects
    if (inAspect.isAnnotationStyleAspect() && !inAspect.isAbstract()) {
      inAspect.crosscuttingMembers.addLateTypeMunger(world.getWeavingSupport().makePerClauseAspect(inAspect, getKind()));
View Full Code Here

    inAspect.crosscuttingMembers.addConcreteShadowMunger(Advice.makePerObjectEntry(world, concreteEntry, isThis, inAspect));

    // FIXME AV - don't use lateMunger here due to test
    // "inheritance, around advice and abstract pointcuts"
    // see #75442 thread. Issue with weaving order.
    ResolvedTypeMunger munger = new PerObjectInterfaceTypeMunger(inAspect, concreteEntry);
    inAspect.crosscuttingMembers.addLateTypeMunger(world.getWeavingSupport().concreteTypeMunger(munger, inAspect));

    // ATAJ: add a munger to add the aspectOf(..) to the @AJ aspects
    if (inAspect.isAnnotationStyleAspect() && !inAspect.isAbstract()) {
      inAspect.crosscuttingMembers.addLateTypeMunger(inAspect.getWorld().getWeavingSupport().makePerClauseAspect(inAspect,
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.ResolvedTypeMunger

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.