Examples of ResolvedType


Examples of org.aspectj.weaver.ResolvedType

    // continue to fault in the model.
    if (!sourceFileNode.getKind().equals(IProgramElement.Kind.FILE_JAVA)) {
      return;
    }

    ResolvedType aspect = munger.getDeclaringType();

    // create the class file node
    IProgramElement classFileNode = new ProgramElement(asm, sourceFileNode.getName(), IProgramElement.Kind.FILE,
        munger.getBinarySourceLocation(aspect.getSourceLocation()), 0, null, null);

    // create package ipe if one exists....
    IProgramElement root = asm.getHierarchy().getRoot();
    IProgramElement binaries = asm.getHierarchy().findElementForLabel(root, IProgramElement.Kind.SOURCE_FOLDER, "binaries");
    if (binaries == null) {
      binaries = new ProgramElement(asm, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList());
      root.addChild(binaries);
    }
    // if (aspect.getPackageName() != null) {
    String packagename = aspect.getPackageName() == null ? "" : aspect.getPackageName();
    // check that there doesn't already exist a node with this name
    IProgramElement pkgNode = asm.getHierarchy().findElementForLabel(binaries, IProgramElement.Kind.PACKAGE, packagename);
    // note packages themselves have no source location
    if (pkgNode == null) {
      pkgNode = new ProgramElement(asm, packagename, IProgramElement.Kind.PACKAGE, new ArrayList());
      binaries.addChild(pkgNode);
      pkgNode.addChild(classFileNode);
    } else {
      // need to add it first otherwise the handle for classFileNode
      // may not be generated correctly if it uses information from
      // it's parent node
      pkgNode.addChild(classFileNode);
      for (Iterator iter = pkgNode.getChildren().iterator(); iter.hasNext();) {
        IProgramElement element = (IProgramElement) iter.next();
        if (!element.equals(classFileNode) && element.getHandleIdentifier().equals(classFileNode.getHandleIdentifier())) {
          // already added the classfile so have already
          // added the structure for this aspect
          pkgNode.removeChild(classFileNode);
          return;
        }
      }
    }
    // } else {
    // // need to add it first otherwise the handle for classFileNode
    // // may not be generated correctly if it uses information from
    // // it's parent node
    // root.addChild(classFileNode);
    // for (Iterator iter = root.getChildren().iterator(); iter.hasNext();)
    // {
    // IProgramElement element = (IProgramElement) iter.next();
    // if (!element.equals(classFileNode) &&
    // element.getHandleIdentifier().equals
    // (classFileNode.getHandleIdentifier())) {
    // // already added the sourcefile so have already
    // // added the structure for this aspect
    // root.removeChild(classFileNode);
    // return;
    // }
    // }
    // }

    // add and create empty import declaration ipe
    // classFileNode.addChild(new ProgramElement(asm, "import declarations", IProgramElement.Kind.IMPORT_REFERENCE, null, 0,
    // null,
    // null));

    // add and create aspect ipe
    IProgramElement aspectNode = new ProgramElement(asm, aspect.getSimpleName(), IProgramElement.Kind.ASPECT,
        munger.getBinarySourceLocation(aspect.getSourceLocation()), aspect.getModifiers(), null, null);
    classFileNode.addChild(aspectNode);

    String sourcefilename = getSourceFileName(aspect);
    addPointcuts(asm, sourcefilename, aspect, aspectNode, aspect.getDeclaredPointcuts());
    addChildNodes(asm, aspect, aspectNode, aspect.getDeclaredAdvice());
    addChildNodes(asm, aspect, aspectNode, aspect.getDeclares());
    addChildNodes(asm, aspect, aspectNode, aspect.getTypeMungers());

  }
View Full Code Here

Examples of org.aspectj.weaver.ResolvedType

   * @return
   */
  public BcelVar getThisJoinPointStaticPartBcelVar(final boolean isEnclosingJp) {
    if (thisJoinPointStaticPartVar == null) {
      Field field = getEnclosingClass().getTjpField(this, isEnclosingJp);
      ResolvedType sjpType = null;
      if (world.isTargettingAspectJRuntime12()) { // TAG:SUPPORTING12: We didn't have different jpsp types in 1.2
        sjpType = world.getCoreType(UnresolvedType.JOINPOINT_STATICPART);
      } else {
        sjpType = isEnclosingJp ? world.getCoreType(UnresolvedType.JOINPOINT_ENCLOSINGSTATICPART) : world
            .getCoreType(UnresolvedType.JOINPOINT_STATICPART);
View Full Code Here

Examples of org.aspectj.weaver.ResolvedType

      targetAnnotationVars = new HashMap<ResolvedType, TypeAnnotationAccessVar>();
      ResolvedType[] rtx = this.getTargetType().resolve(world).getAnnotationTypes(); // what about annotations we havent
      // gotten yet but we will get in
      // subclasses?
      for (int i = 0; i < rtx.length; i++) {
        ResolvedType typeX = rtx[i];
        targetAnnotationVars.put(typeX, new TypeAnnotationAccessVar(typeX, (BcelVar) getTargetVar()));
      }
      // populate.
    }
  }
View Full Code Here

Examples of org.aspectj.weaver.ResolvedType

    kindedAnnotationVars = new HashMap<ResolvedType, AnnotationAccessVar>();

    ResolvedType[] annotations = null;
    Member shadowSignature = getSignature();
    Member annotationHolder = getSignature();
    ResolvedType relevantType = shadowSignature.getDeclaringType().resolve(world);

    if (relevantType.isRawType() || relevantType.isParameterizedType()) {
      relevantType = relevantType.getGenericType();
    }

    // Determine the annotations that are of interest
    if (getKind() == Shadow.StaticInitialization) {
      annotations = relevantType.resolve(world).getAnnotationTypes();
    } else if (getKind() == Shadow.MethodCall || getKind() == Shadow.ConstructorCall) {
      ResolvedMember foundMember = findMethod2(relevantType.resolve(world).getDeclaredMethods(), getSignature());
      annotations = getAnnotations(foundMember, shadowSignature, relevantType);
      annotationHolder = getRelevantMember(foundMember, shadowSignature, relevantType);
      relevantType = annotationHolder.getDeclaringType().resolve(world);
    } else if (getKind() == Shadow.FieldSet || getKind() == Shadow.FieldGet) {
      annotationHolder = findField(relevantType.getDeclaredFields(), getSignature());

      if (annotationHolder == null) {
        // check the ITD'd dooberries
        List<ConcreteTypeMunger> mungers = relevantType.resolve(world).getInterTypeMungers();
        for (ConcreteTypeMunger typeMunger : mungers) {
          if (typeMunger.getMunger() instanceof NewFieldTypeMunger) {
            ResolvedMember fakerm = typeMunger.getSignature();
            // if (fakerm.hasAnnotations())
            ResolvedMember ajcMethod = AjcMemberMaker.interFieldInitializer(fakerm, typeMunger.getAspectType());
            ResolvedMember rmm = findMethod(typeMunger.getAspectType(), ajcMethod);
            if (fakerm.equals(getSignature())) {
              relevantType = typeMunger.getAspectType();
              annotationHolder = rmm;
            }
          }
        }
      }
      annotations = ((ResolvedMember) annotationHolder).getAnnotationTypes();

    } else if (getKind() == Shadow.MethodExecution || getKind() == Shadow.ConstructorExecution
        || getKind() == Shadow.AdviceExecution) {

      ResolvedMember foundMember = findMethod2(relevantType.getDeclaredMethods(), getSignature());
      annotations = getAnnotations(foundMember, shadowSignature, relevantType);
      annotationHolder = getRelevantMember(foundMember, annotationHolder, relevantType);
      UnresolvedType ut = annotationHolder.getDeclaringType();
      relevantType = ut.resolve(world);

    } else if (getKind() == Shadow.ExceptionHandler) {
      relevantType = getSignature().getParameterTypes()[0].resolve(world);
      annotations = relevantType.getAnnotationTypes();

    } else if (getKind() == Shadow.PreInitialization || getKind() == Shadow.Initialization) {
      ResolvedMember found = findMethod2(relevantType.getDeclaredMethods(), getSignature());
      annotations = found.getAnnotationTypes();
    }

    if (annotations == null) {
      // We can't have recognized the shadow - should blow up now to be on the safe side
View Full Code Here

Examples of org.aspectj.weaver.ResolvedType

    }
    withinAnnotationVars = new HashMap<ResolvedType, AnnotationAccessVar>();

    ResolvedType[] annotations = getEnclosingType().resolve(world).getAnnotationTypes();
    for (int i = 0; i < annotations.length; i++) {
      ResolvedType ann = annotations[i];
      Kind k = Shadow.StaticInitialization;
      withinAnnotationVars.put(ann, new AnnotationAccessVar(this, k, ann, getEnclosingType(), null));
    }
  }
View Full Code Here

Examples of org.aspectj.weaver.ResolvedType

    withincodeAnnotationVars = new HashMap<ResolvedType, AnnotationAccessVar>();

    // For some shadow we are interested in annotations on the method containing that shadow.
    ResolvedType[] annotations = getEnclosingMethod().getMemberView().getAnnotationTypes();
    for (int i = 0; i < annotations.length; i++) {
      ResolvedType ann = annotations[i];
      Kind k = (getEnclosingMethod().getMemberView().getKind() == Member.CONSTRUCTOR ? Shadow.ConstructorExecution
          : Shadow.MethodExecution);
      withincodeAnnotationVars.put(ann,
          new AnnotationAccessVar(this, k, ann, getEnclosingType(), getEnclosingCodeSignature()));
    }
View Full Code Here

Examples of org.aspectj.weaver.ResolvedType

    // pr62642
    // I will now jump through some firey BCEL hoops to generate a trivial bit of code:
    // if (exc instanceof ExceptionInInitializerError)
    // throw (ExceptionInInitializerError)exc;
    if (this.getEnclosingMethod().getName().equals("<clinit>")) {
      ResolvedType eiieType = world.resolve("java.lang.ExceptionInInitializerError");
      ObjectType eiieBcelType = (ObjectType) BcelWorld.makeBcelType(eiieType);
      InstructionList ih = new InstructionList(InstructionConstants.NOP);
      handler.append(exceptionVar.createLoad(fact));
      handler.append(fact.createInstanceOf(eiieBcelType));
      InstructionBranch bi = InstructionFactory.createBranchInstruction(Constants.IFEQ, ih.getStart());
View Full Code Here

Examples of org.aspectj.weaver.ResolvedType

      ResolvedMember rm = (ResolvedMember) mungerSig;
      if (rm.hasBackingGenericMember()) {
        mungerSig = rm.getBackingGenericMember();
      }
    }
    ResolvedType declaringAspectType = world.resolve(mungerSig.getDeclaringType(), true);
    if (declaringAspectType.isMissing()) {
      world.getLint().cantFindType.signal(new String[] { WeaverMessages.format(
          WeaverMessages.CANT_FIND_TYPE_DURING_AROUND_WEAVE, declaringAspectType.getClassName()) }, getSourceLocation(),
          new ISourceLocation[] { munger.getSourceLocation() });
    }

    // ??? might want some checks here to give better errors
    ResolvedType rt = (declaringAspectType.isParameterizedType() ? declaringAspectType.getGenericType() : declaringAspectType);
    BcelObjectType ot = BcelWorld.getBcelObjectType(rt);
    LazyMethodGen adviceMethod = ot.getLazyClassGen().getLazyMethodGen(mungerSig);
    if (!adviceMethod.getCanInline()) {
      weaveAroundClosure(munger, hasDynamicTest);
      return;
View Full Code Here

Examples of org.aspectj.weaver.ResolvedType

    Type[] stateTypes = callbackMethod.getArgumentTypes();
    // System.out.println("stateTypes: " + Arrays.asList(stateTypes));

    for (int i = 0, len = stateTypes.length; i < len; i++) {
      Type stateType = stateTypes[i];
      ResolvedType stateTypeX = BcelWorld.fromBcel(stateType).resolve(world);
      if (proceedMap.hasKey(i)) {
        // throw new RuntimeException("unimplemented");
        proceedVars[proceedMap.get(i)].appendLoadAndConvert(ret, fact, stateTypeX);
      } else {
        argVarList.get(i).appendLoad(ret, fact);
View Full Code Here

Examples of org.aspectj.weaver.ResolvedType

      Type[] stateTypes = getSuperConstructorParameterTypes();

      returnConversionCode.append(InstructionConstants.ALOAD_0); // put "this" back on the stack
      for (int i = 0, len = stateTypes.length; i < len; i++) {
        UnresolvedType bcelTX = BcelWorld.fromBcel(stateTypes[i]);
        ResolvedType stateRTX = world.resolve(bcelTX, true);
        if (stateRTX.isMissing()) {
          world.getLint().cantFindType.signal(new String[] { WeaverMessages.format(
              WeaverMessages.CANT_FIND_TYPE_DURING_AROUND_WEAVE_PREINIT, bcelTX.getClassName()) },
              getSourceLocation(), new ISourceLocation[] { munger.getSourceLocation() });
          // IMessage msg = new Message(
          // WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_DURING_AROUND_WEAVE_PREINIT,bcelTX.getClassName()),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.