Package org.aspectj.weaver

Examples of org.aspectj.weaver.NewParentTypeMunger


        // 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


    if (changed && worthReporting) {
      ResolvedType declaringAspect = null;
      AsmManager model = ((BcelWorld) getWorld()).getModelAsAsmManager();
      if (model != null) {
        if (munger instanceof NewParentTypeMunger) {
          NewParentTypeMunger nptMunger = (NewParentTypeMunger) munger;
          declaringAspect = nptMunger.getDeclaringType();
          if (declaringAspect.isParameterizedOrGenericType()) {
            declaringAspect = declaringAspect.getRawType();
          }
          ResolvedType thisAspect = getAspectType();
          AsmRelationshipProvider.addRelationship(model, weaver.getLazyClassGen().getType(), munger, thisAspect);

          // Add a relationship on the actual declaring aspect too
          if (!thisAspect.equals(declaringAspect)) {
            // Might be the case the declaring aspect is generic and thisAspect is parameterizing it. In that case
            // record the actual parameterizations

            ResolvedType target = weaver.getLazyClassGen().getType();
            ResolvedType newParent = nptMunger.getNewParent();
            IProgramElement thisAspectNode = model.getHierarchy().findElementForType(thisAspect.getPackageName(),
                thisAspect.getClassName());
            Map<String, List<String>> declareParentsMap = thisAspectNode.getDeclareParentsMap();
            if (declareParentsMap == null) {
              declareParentsMap = new HashMap<String, List<String>>();
              thisAspectNode.setDeclareParentsMap(declareParentsMap);
            }
            String tname = target.getName();
            String pname = newParent.getName();
            List<String> newparents = declareParentsMap.get(tname);
            if (newparents == null) {
              newparents = new ArrayList<String>();
              declareParentsMap.put(tname, newparents);
            }
            newparents.add(pname);
            AsmRelationshipProvider.addRelationship(model, weaver.getLazyClassGen().getType(), munger, declaringAspect);
          }
        } else {
          declaringAspect = getAspectType();
          AsmRelationshipProvider.addRelationship(model, weaver.getLazyClassGen().getType(), munger, declaringAspect);
        }
      }
    }

    // TAG: WeavingMessage
    if (changed && worthReporting && munger != null && !weaver.getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) {
      String tName = weaver.getLazyClassGen().getType().getSourceLocation().getSourceFile().getName();
      if (tName.indexOf("no debug info available") != -1) {
        tName = "no debug info available";
      } else {
        tName = getShortname(weaver.getLazyClassGen().getType().getSourceLocation().getSourceFile().getPath());
      }
      String fName = getShortname(getAspectType().getSourceLocation().getSourceFile().getPath());
      if (munger.getKind().equals(ResolvedTypeMunger.Parent)) {
        // This message could come out of AjLookupEnvironment.addParent
        // if doing parents munging at compile time only...
        NewParentTypeMunger parentTM = (NewParentTypeMunger) munger;
        if (parentTM.isMixin()) {
          weaver.getWorld()
              .getMessageHandler()
              .handleMessage(
                  WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_MIXIN, new String[] {
                      parentTM.getNewParent().getName(), fName, weaver.getLazyClassGen().getType().getName(),
                      tName }, weaver.getLazyClassGen().getClassName(), getAspectType().getName()));
        } else {
          if (parentTM.getNewParent().isInterface()) {
            weaver.getWorld()
                .getMessageHandler()
                .handleMessage(
                    WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_DECLAREPARENTSIMPLEMENTS,
                        new String[] { weaver.getLazyClassGen().getType().getName(), tName,
                            parentTM.getNewParent().getName(), fName }, weaver.getLazyClassGen()
                            .getClassName(), getAspectType().getName()));
          } else {
            weaver.getWorld()
                .getMessageHandler()
                .handleMessage(
                    WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_DECLAREPARENTSEXTENDS,
                        new String[] { weaver.getLazyClassGen().getType().getName(), tName,
                            parentTM.getNewParent().getName(), fName }));
            // TAG: WeavingMessage DECLARE PARENTS: EXTENDS
            // reportDeclareParentsMessage(WeaveMessage.
            // WEAVEMESSAGE_DECLAREPARENTSEXTENDS,sourceType,parent);

          }
View Full Code Here

        // itself
        // (like transform super calls) - that is done in
        // BcelTypeMunger.mungeNewParent()
        // classType.addParent(newParent);
        onType.addParent(newParent);
        NewParentTypeMunger newParentMunger = new NewParentTypeMunger(newParent, p.getDeclaringType());
        if (p.isMixin()) {
          newParentMunger.setIsMixin(true);
        }
        newParentMunger.setSourceLocation(p.getSourceLocation());
        onType.addInterTypeMunger(new BcelTypeMunger(newParentMunger, xcutSet.findAspectDeclaringParents(p)), false);
      }
    }
    return didSomething;
  }
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

    if (changed && worthReporting) {
      ResolvedType declaringAspect = null;
      AsmManager model = ((BcelWorld) getWorld()).getModelAsAsmManager();
      if (model != null) {
        if (munger instanceof NewParentTypeMunger) {
          NewParentTypeMunger nptMunger = (NewParentTypeMunger) munger;
          declaringAspect = nptMunger.getDeclaringType();
          if (declaringAspect.isParameterizedOrGenericType()) {
            declaringAspect = declaringAspect.getRawType();
          }
          ResolvedType thisAspect = getAspectType();
          AsmRelationshipProvider.addRelationship(model, weaver.getLazyClassGen().getType(), munger, thisAspect);

          // Add a relationship on the actual declaring aspect too
          if (!thisAspect.equals(declaringAspect)) {
            // Might be the case the declaring aspect is generic and thisAspect is parameterizing it. In that case
            // record the actual parameterizations

            ResolvedType target = weaver.getLazyClassGen().getType();
            ResolvedType newParent = nptMunger.getNewParent();
            IProgramElement thisAspectNode = model.getHierarchy().findElementForType(thisAspect.getPackageName(),
                thisAspect.getClassName());
            Map<String, List<String>> declareParentsMap = thisAspectNode.getDeclareParentsMap();
            if (declareParentsMap == null) {
              declareParentsMap = new HashMap<String, List<String>>();
              thisAspectNode.setDeclareParentsMap(declareParentsMap);
            }
            String tname = target.getName();
            String pname = newParent.getName();
            List<String> newparents = declareParentsMap.get(tname);
            if (newparents == null) {
              newparents = new ArrayList<String>();
              declareParentsMap.put(tname, newparents);
            }
            newparents.add(pname);
            AsmRelationshipProvider.addRelationship(model, weaver.getLazyClassGen().getType(), munger, declaringAspect);
          }
        } else {
          declaringAspect = getAspectType();
          AsmRelationshipProvider.addRelationship(model, weaver.getLazyClassGen().getType(), munger, declaringAspect);
        }
      }
    }

    // TAG: WeavingMessage
    if (changed && worthReporting && munger != null && !weaver.getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) {
      String tName = weaver.getLazyClassGen().getType().getSourceLocation().getSourceFile().getName();
      if (tName.indexOf("no debug info available") != -1) {
        tName = "no debug info available";
      } else {
        tName = getShortname(weaver.getLazyClassGen().getType().getSourceLocation().getSourceFile().getPath());
      }
      String fName = getShortname(getAspectType().getSourceLocation().getSourceFile().getPath());
      if (munger.getKind().equals(ResolvedTypeMunger.Parent)) {
        // This message could come out of AjLookupEnvironment.addParent
        // if doing parents munging at compile time only...
        NewParentTypeMunger parentTM = (NewParentTypeMunger) munger;
        if (parentTM.isMixin()) {
          weaver.getWorld()
              .getMessageHandler()
              .handleMessage(
                  WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_MIXIN, new String[] {
                      parentTM.getNewParent().getName(), fName, weaver.getLazyClassGen().getType().getName(),
                      tName }, weaver.getLazyClassGen().getClassName(), getAspectType().getName()));
        } else {
          if (parentTM.getNewParent().isInterface()) {
            weaver.getWorld()
                .getMessageHandler()
                .handleMessage(
                    WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_DECLAREPARENTSIMPLEMENTS,
                        new String[] { weaver.getLazyClassGen().getType().getName(), tName,
                            parentTM.getNewParent().getName(), fName }, weaver.getLazyClassGen()
                            .getClassName(), getAspectType().getName()));
          } else {
            weaver.getWorld()
                .getMessageHandler()
                .handleMessage(
                    WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_DECLAREPARENTSEXTENDS,
                        new String[] { weaver.getLazyClassGen().getType().getName(), tName,
                            parentTM.getNewParent().getName(), fName }));
            // TAG: WeavingMessage DECLARE PARENTS: EXTENDS
            // reportDeclareParentsMessage(WeaveMessage.
            // WEAVEMESSAGE_DECLAREPARENTSEXTENDS,sourceType,parent);

          }
View Full Code Here

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

        // itself
        // (like transform super calls) - that is done in
        // BcelTypeMunger.mungeNewParent()
        // classType.addParent(newParent);
        onType.addParent(newParent);
        NewParentTypeMunger newParentMunger = new NewParentTypeMunger(newParent);
        if (p.isMixin()) {
          newParentMunger.setIsMixin(true);
        }
        newParentMunger.setSourceLocation(p.getSourceLocation());
        onType.addInterTypeMunger(new BcelTypeMunger(newParentMunger, xcutSet.findAspectDeclaringParents(p)), false);
      }
    }
    return didSomething;
  }
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);
        newParentMunger.setSourceLocation(p.getSourceLocation());
        onType.addInterTypeMunger(new BcelTypeMunger(newParentMunger, getCrosscuttingMembersSet()
            .findAspectDeclaringParents(p)), false);
      }
    }
    return didSomething;
View Full Code Here

      }
      String fName = getShortname(getAspectType().getSourceLocation().getSourceFile().getPath());
      if (munger.getKind().equals(ResolvedTypeMunger.Parent)) {
        // This message could come out of AjLookupEnvironment.addParent
        // if doing parents munging at compile time only...
        NewParentTypeMunger parentTM = (NewParentTypeMunger) munger;
        if (parentTM.isMixin()) {
          weaver.getWorld().getMessageHandler().handleMessage(
              WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_MIXIN,
                  new String[] { parentTM.getNewParent().getName(), fName,
                      weaver.getLazyClassGen().getType().getName(), tName }, weaver.getLazyClassGen()
                      .getClassName(), getAspectType().getName()));
        } else {
          if (parentTM.getNewParent().isInterface()) {
            weaver.getWorld().getMessageHandler().handleMessage(
                WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_DECLAREPARENTSIMPLEMENTS,
                    new String[] { weaver.getLazyClassGen().getType().getName(), tName,
                        parentTM.getNewParent().getName(), fName },
                    weaver.getLazyClassGen().getClassName(), getAspectType().getName()));
          } else {
            weaver.getWorld().getMessageHandler().handleMessage(
                WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_DECLAREPARENTSEXTENDS, new String[] {
                    weaver.getLazyClassGen().getType().getName(), tName, parentTM.getNewParent().getName(),
                    fName }));
            // TAG: WeavingMessage DECLARE PARENTS: EXTENDS
            // reportDeclareParentsMessage(WeaveMessage.
            // WEAVEMESSAGE_DECLAREPARENTSEXTENDS,sourceType,parent);
View Full Code Here

      else tName = getShortname(weaver.getLazyClassGen().getType().getSourceLocation().getSourceFile().getPath());
      String fName = getShortname(getAspectType().getSourceLocation().getSourceFile().getPath());
          if (munger.getKind().equals(ResolvedTypeMunger.Parent)) {
            // This message could come out of AjLookupEnvironment.addParent if doing parents
            // munging at compile time only...
            NewParentTypeMunger parentTM = (NewParentTypeMunger)munger;
            if (parentTM.getNewParent().isInterface()) {
          weaver.getWorld().getMessageHandler().handleMessage(WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_DECLAREPARENTSIMPLEMENTS,
          new String[]{weaver.getLazyClassGen().getType().getName(),
          tName,parentTM.getNewParent().getName(),fName},
          weaver.getLazyClassGen().getClassName(), getAspectType().getName()));
            } else {
                    weaver.getWorld().getMessageHandler().handleMessage(
                    WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_DECLAREPARENTSEXTENDS,
                        new String[]{weaver.getLazyClassGen().getType().getName(),
                            tName,parentTM.getNewParent().getName(),fName
                                }));
//                  TAG: WeavingMessage    DECLARE PARENTS: EXTENDS
//                  reportDeclareParentsMessage(WeaveMessage.WEAVEMESSAGE_DECLAREPARENTSEXTENDS,sourceType,parent);
                   
            }
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.NewParentTypeMunger

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.