Package org.aspectj.weaver

Examples of org.aspectj.weaver.ResolvedMemberImpl


        // already have

      } else {

        // Create a counter field in the aspect
        localCflowField = new ResolvedMemberImpl(Member.FIELD, concreteAspect, Modifier.STATIC | Modifier.PUBLIC
            | Modifier.FINAL, NameMangler.cflowCounter(xcut), UnresolvedType.forName(NameMangler.CFLOW_COUNTER_TYPE)
            .getSignature());

        // Create type munger to add field to the aspect
        concreteAspect.crosscuttingMembers.addTypeMunger(world.getWeavingSupport().makeCflowCounterFieldAdder(
            localCflowField));

        // Create shadow munger to push stuff onto the stack
        concreteAspect.crosscuttingMembers.addConcreteShadowMunger(Advice.makeCflowEntry(world, concreteEntry, isBelow,
            localCflowField, freeVars == null ? 0 : freeVars.length, innerCflowEntries, inAspect));

        putCflowfield(xcut, concreteEntry, concreteAspect, localCflowField, "counter"); // Remember
        // it
      }

      Pointcut ret = new ConcreteCflowPointcut(concreteAspect, localCflowField, null, true);
      ret.copyLocationFrom(this);
      return ret;
    } else {

      List slots = new ArrayList();

      for (int i = 0, len = freeVars.length; i < len; i++) {
        int freeVar = freeVars[i];

        // we don't need to keep state that isn't actually exposed to
        // advice
        // ??? this means that we will store some state that we won't
        // actually use, optimize this later
        if (!bindings.hasKey(freeVar)) {
          continue;
        }

        int formalIndex = bindings.get(freeVar);

        // We need to look in the right place for the type of the
        // formal. Suppose the advice looks like this:
        // before(String s): somePointcut(*,s)
        // where the first argument in somePointcut is of type Number
        // for free variable 0 we want to ask the pointcut for the type
        // of its first argument, if we only
        // ask the advice for the type of its first argument then we'll
        // get the wrong type (pr86903)

        ResolvedPointcutDefinition enclosingDef = bindings.peekEnclosingDefinition();
        ResolvedType formalType = null;

        // Is there a useful enclosing pointcut?
        if (enclosingDef != null && enclosingDef.getParameterTypes().length > 0) {
          formalType = enclosingDef.getParameterTypes()[freeVar].resolve(world);
        } else {
          formalType = bindings.getAdviceSignature().getParameterTypes()[formalIndex].resolve(world);
        }

        ConcreteCflowPointcut.Slot slot = new ConcreteCflowPointcut.Slot(formalIndex, formalType, i);
        slots.add(slot);
      }
      ResolvedMember localCflowField = null;
      Object field = getCflowfield(xcut, concreteEntry, concreteAspect, "stack");
      if (field != null) {
        localCflowField = (ResolvedMember) field;
      } else {

        localCflowField = new ResolvedMemberImpl(Member.FIELD, concreteAspect, Modifier.STATIC | Modifier.PUBLIC
            | Modifier.FINAL, NameMangler.cflowStack(xcut), UnresolvedType.forName(NameMangler.CFLOW_STACK_TYPE)
            .getSignature());
        // System.out.println("adding field to: " + inAspect + " field "
        // + cflowField);

View Full Code Here


    int pos = 0;

    ResolvedMember whatToBridgeTo = whatToBridgeToMethodGen.getMemberView();

    if (whatToBridgeTo == null) {
      whatToBridgeTo = new ResolvedMemberImpl(Member.METHOD, whatToBridgeToMethodGen.getEnclosingClass().getType(),
          whatToBridgeToMethodGen.getAccessFlags(), whatToBridgeToMethodGen.getName(),
          whatToBridgeToMethodGen.getSignature());
    }
    // The bridge method in this type will have the same signature as the one in the supertype
    LazyMethodGen bridgeMethod = makeBridgeMethod(clazz, theBridgeMethod);
View Full Code Here

    ret.setGenericSignatureInformationProvider(createGenericSignatureProvider(inWorld));
    return ret;
  }

  public static ResolvedMember createStaticInitMember(Class forType, World inWorld) {
    return new ResolvedMemberImpl(org.aspectj.weaver.Member.STATIC_INITIALIZATION, toResolvedType(forType,
        (IReflectionWorld) inWorld), Modifier.STATIC, UnresolvedType.VOID, "<clinit>", new UnresolvedType[0],
        new UnresolvedType[0]);
  }
View Full Code Here

    ret.setGenericSignatureInformationProvider(createGenericSignatureProvider(inWorld));
    return ret;
  }

  public static ResolvedMember createHandlerMember(Class exceptionType, Class inType, World inWorld) {
    return new ResolvedMemberImpl(org.aspectj.weaver.Member.HANDLER, toResolvedType(inType, (IReflectionWorld) inWorld),
        Modifier.STATIC, "<catch>", "(" + inWorld.resolve(exceptionType.getName()).getSignature() + ")V");
  }
View Full Code Here

    if (ret == null) {
      int mods = mg.getAccessFlags();
      if (mg.getEnclosingClass().isInterface()) {
        mods |= Modifier.INTERFACE;
      }
      return new ResolvedMemberImpl(kind, UnresolvedType.forName(mg.getClassName()), mods, fromBcel(mg.getReturnType()),
          mg.getName(), fromBcel(mg.getArgumentTypes()));
    } else {
      return ret;
    }
View Full Code Here

        if (adviceSignature instanceof BcelMethod) {
          BcelMethod bm = (BcelMethod) adviceSignature;
          if (bm.getMethod() != null && bm.getMethod().getAnnotations() != null) {
            return adviceSignature;
          }
          ResolvedMemberImpl simplermember = new ResolvedMemberImpl(bm.getKind(), bm.getDeclaringType(),
              bm.getModifiers(), bm.getReturnType(), bm.getName(), bm.getParameterTypes());// ,bm.getExceptions(),bm.getBackingGenericMember()
          // );
          simplermember.setParameterNames(bm.getParameterNames());
          return simplermember;
        }
      }
    }
    return adviceSignature;
View Full Code Here

      InstructionHandle startOfHandler, BcelShadow enclosingShadow) {
    InstructionList body = enclosingMethod.getBody();
    UnresolvedType catchType = exceptionRange.getCatchType();
    UnresolvedType inType = enclosingMethod.getEnclosingClass().getType();

    ResolvedMemberImpl sig = MemberImpl.makeExceptionHandlerSignature(inType, catchType);
    sig.setParameterNames(new String[] { findHandlerParamName(startOfHandler) });

    BcelShadow s = new BcelShadow(world, ExceptionHandler, sig, enclosingMethod, enclosingShadow);
    ShadowRange r = new ShadowRange(body);
    r.associateWithShadow(s);
    InstructionHandle start = Range.genStart(body, startOfHandler);
View Full Code Here

      }
    }
    // Member signature = ReflectionBasedReferenceTypeDelegateFactory.createStaticInitMember(forType, inWorld);
    Kind kind = Shadow.StaticInitialization;
    if (clinit == -1) {
      Member clinitMember = new ResolvedMemberImpl(org.aspectj.weaver.Member.STATIC_INITIALIZATION, forType, Modifier.STATIC,
          UnresolvedType.VOID, "<clinit>", new UnresolvedType[0], new UnresolvedType[0]);
      return new StandardShadow(inWorld, kind, clinitMember, null, forType, null, withContext);
    } else {
      return new StandardShadow(inWorld, kind, members[clinit], null, forType, null, withContext);
    }
View Full Code Here

    ret.inAspect = inAspect;
    if (inAspect.isAbstract()) {
      return ret;
    }

    Member cflowStackField = new ResolvedMemberImpl(Member.FIELD, inAspect, Modifier.STATIC | Modifier.PUBLIC | Modifier.FINAL,
        UnresolvedType.forName(NameMangler.CFLOW_STACK_TYPE), NameMangler.PERCFLOW_FIELD_NAME, UnresolvedType.NONE);

    World world = inAspect.getWorld();

    CrosscuttingMembers xcut = inAspect.crosscuttingMembers;
View Full Code Here

        // already have

      } else {

        // Create a counter field in the aspect
        localCflowField = new ResolvedMemberImpl(Member.FIELD, concreteAspect, Modifier.STATIC | Modifier.PUBLIC
            | Modifier.FINAL, NameMangler.cflowCounter(xcut), UnresolvedType.forName(NameMangler.CFLOW_COUNTER_TYPE)
            .getSignature());

        // Create type munger to add field to the aspect
        concreteAspect.crosscuttingMembers.addTypeMunger(world.getWeavingSupport().makeCflowCounterFieldAdder(
            localCflowField));

        // Create shadow munger to push stuff onto the stack
        concreteAspect.crosscuttingMembers.addConcreteShadowMunger(Advice.makeCflowEntry(world, concreteEntry, isBelow,
            localCflowField, freeVars == null ? 0 : freeVars.length, innerCflowEntries, inAspect));

        putCflowfield(xcut, concreteEntry, concreteAspect, localCflowField, "counter"); // Remember
        // it
      }

      Pointcut ret = new ConcreteCflowPointcut(concreteAspect, localCflowField, null, true);
      ret.copyLocationFrom(this);
      return ret;
    } else {

      List slots = new ArrayList();

      for (int i = 0, len = freeVars.length; i < len; i++) {
        int freeVar = freeVars[i];

        // we don't need to keep state that isn't actually exposed to
        // advice
        // ??? this means that we will store some state that we won't
        // actually use, optimize this later
        if (!bindings.hasKey(freeVar)) {
          continue;
        }

        int formalIndex = bindings.get(freeVar);

        // We need to look in the right place for the type of the
        // formal. Suppose the advice looks like this:
        // before(String s): somePointcut(*,s)
        // where the first argument in somePointcut is of type Number
        // for free variable 0 we want to ask the pointcut for the type
        // of its first argument, if we only
        // ask the advice for the type of its first argument then we'll
        // get the wrong type (pr86903)

        ResolvedPointcutDefinition enclosingDef = bindings.peekEnclosingDefinition();
        ResolvedType formalType = null;

        // Is there a useful enclosing pointcut?
        if (enclosingDef != null && enclosingDef.getParameterTypes().length > 0) {
          formalType = enclosingDef.getParameterTypes()[freeVar].resolve(world);
        } else {
          formalType = bindings.getAdviceSignature().getParameterTypes()[formalIndex].resolve(world);
        }

        ConcreteCflowPointcut.Slot slot = new ConcreteCflowPointcut.Slot(formalIndex, formalType, i);
        slots.add(slot);
      }
      ResolvedMember localCflowField = null;
      Object field = getCflowfield(xcut, concreteEntry, concreteAspect, "stack");
      if (field != null) {
        localCflowField = (ResolvedMember) field;
      } else {

        localCflowField = new ResolvedMemberImpl(Member.FIELD, concreteAspect, Modifier.STATIC | Modifier.PUBLIC
            | Modifier.FINAL, NameMangler.cflowStack(xcut), UnresolvedType.forName(NameMangler.CFLOW_STACK_TYPE)
            .getSignature());
        // System.out.println("adding field to: " + inAspect + " field "
        // + cflowField);

View Full Code Here

TOP

Related Classes of org.aspectj.weaver.ResolvedMemberImpl

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.