Package org.aspectj.weaver

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


    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

    }
    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

    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

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

      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

    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

      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

    Type[] stateTypes = callbackMethod.getArgumentTypes();

    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)) {
        mbody.append(proceedVar.createConvertableArrayLoad(fact, proceedMap.get(i), stateTypeX));
      } else {
        mbody.append(stateVar.createConvertableArrayLoad(fact, i, stateTypeX));
      }
View Full Code Here

          TypePattern tp = newParents[i];
          UnresolvedType tx = tp.getExactType();
          if (kindOfDP == null) {
            kindOfDP = "implements ";
            try {
              ResolvedType rtx = tx.resolve(((AjLookupEnvironment) declare.scope.environment()).factory.getWorld());
              if (!rtx.isInterface()) {
                kindOfDP = "extends ";
              }
            } catch (Throwable t) {
              // What can go wrong???? who knows!
            }
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.ResolvedType

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.