Package org.aspectj.weaver

Examples of org.aspectj.weaver.Member


  }

  public static BcelShadow makeMonitorEnter(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle monitorInstruction,
      BcelShadow enclosingShadow) {
    final InstructionList body = enclosingMethod.getBody();
    Member sig = world.makeJoinPointSignatureForMonitorEnter(enclosingMethod.getEnclosingClass(), monitorInstruction);
    BcelShadow s = new BcelShadow(world, SynchronizationLock, sig, enclosingMethod, enclosingShadow);
    ShadowRange r = new ShadowRange(body);
    r.associateWithShadow(s);
    r.associateWithTargets(Range.genStart(body, monitorInstruction), Range.genEnd(body, monitorInstruction));
    retargetAllBranches(monitorInstruction, r.getStart());
View Full Code Here


  }

  public static BcelShadow makeMonitorExit(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle monitorInstruction,
      BcelShadow enclosingShadow) {
    final InstructionList body = enclosingMethod.getBody();
    Member sig = world.makeJoinPointSignatureForMonitorExit(enclosingMethod.getEnclosingClass(), monitorInstruction);
    BcelShadow s = new BcelShadow(world, SynchronizationUnlock, sig, enclosingMethod, enclosingShadow);
    ShadowRange r = new ShadowRange(body);
    r.associateWithShadow(s);
    r.associateWithTargets(Range.genStart(body, monitorInstruction), Range.genEnd(body, monitorInstruction));
    retargetAllBranches(monitorInstruction, r.getStart());
View Full Code Here

   * method checks for the peculiar set of conditions and if they are true, it has a sneak peek at the code before the call to see
   * what is on the stack.
   */
  public UnresolvedType ensureTargetTypeIsCorrect(UnresolvedType tx) {

    Member msig = getSignature();
    if (msig.getArity() == 0 && getKind() == MethodCall && msig.getName().charAt(0) == 'c' && tx.equals(ResolvedType.OBJECT)
        && msig.getReturnType().equals(ResolvedType.OBJECT) && msig.getName().equals("clone")) {

      // Lets go back through the code from the start of the shadow
      InstructionHandle searchPtr = range.getStart().getPrev();
      while (Range.isRangeHandle(searchPtr) || searchPtr.getInstruction().isStoreInstruction()) { // ignore this instruction -
        // it doesnt give us the
View Full Code Here

      return;
    }
    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();
View Full Code Here

  private Map annotationVar = new HashMap();
  private AnnotationFinder annotationFinder;

  public static Shadow makeExecutionShadow(World inWorld, java.lang.reflect.Member forMethod, MatchingContext withContext) {
    Kind kind = (forMethod instanceof Method) ? Shadow.MethodExecution : Shadow.ConstructorExecution;
    Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(forMethod, inWorld);
    ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld);
    return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext);
  }
View Full Code Here

    return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext);
  }

  public static Shadow makeAdviceExecutionShadow(World inWorld, java.lang.reflect.Method forMethod, MatchingContext withContext) {
    Kind kind = Shadow.AdviceExecution;
    Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedAdviceMember(forMethod, inWorld);
    ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld);
    return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext);
  }
View Full Code Here

  }

  public static Shadow makeCallShadow(World inWorld, java.lang.reflect.Member aMember, java.lang.reflect.Member withinCode,
      MatchingContext withContext) {
    Shadow enclosingShadow = makeExecutionShadow(inWorld, withinCode, withContext);
    Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(aMember, inWorld);
    ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(withinCode, inWorld);
    ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld);
    Kind kind = aMember instanceof Method ? Shadow.MethodCall : Shadow.ConstructorCall;
    return new ReflectionShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext);
  }
View Full Code Here

  }

  public static Shadow makeCallShadow(World inWorld, java.lang.reflect.Member aMember, Class thisClass,
      MatchingContext withContext) {
    Shadow enclosingShadow = makeStaticInitializationShadow(inWorld, thisClass, withContext);
    Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(aMember, inWorld);
    ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createStaticInitMember(thisClass, inWorld);
    ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld);
    Kind kind = aMember instanceof Method ? Shadow.MethodCall : Shadow.ConstructorCall;
    return new ReflectionShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext);
  }
View Full Code Here

    Kind kind = aMember instanceof Method ? Shadow.MethodCall : Shadow.ConstructorCall;
    return new ReflectionShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext);
  }

  public static Shadow makeStaticInitializationShadow(World inWorld, Class forType, MatchingContext withContext) {
    Member signature = ReflectionBasedReferenceTypeDelegateFactory.createStaticInitMember(forType, inWorld);
    ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld);
    Kind kind = Shadow.StaticInitialization;
    return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext);
  }
View Full Code Here

    return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext);
  }

  public static Shadow makePreInitializationShadow(World inWorld, Constructor forConstructor, MatchingContext withContext) {
    Kind kind = Shadow.PreInitialization;
    Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(forConstructor, inWorld);
    ResolvedType enclosingType = signature.getDeclaringType().resolve(inWorld);
    return new ReflectionShadow(inWorld, kind, signature, null, enclosingType, null, withContext);
  }
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.Member

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.