Package org.aspectj.weaver

Examples of org.aspectj.weaver.UnresolvedType


  public Member makeJoinPointSignatureForMethodInvocation(LazyClassGen cg, InvokeInstruction ii) {
    ConstantPool cpg = cg.getConstantPool();
    String name = ii.getName(cpg);
    String declaring = ii.getClassName(cpg);
    UnresolvedType declaringType = null;

    String signature = ii.getSignature(cpg);

    int modifier = (ii instanceof INVOKEINTERFACE) ? Modifier.INTERFACE
        : (ii.opcode == Constants.INVOKESTATIC) ? Modifier.STATIC : (ii.opcode == Constants.INVOKESPECIAL && !name
View Full Code Here


    FormalBinding[] bindings = new FormalBinding[baseArgumentCount];
    for (int i = 0, len = baseArgumentCount; i < len; i++) {
      Argument arg = arguments[i];
      String name = new String(arg.name);
      UnresolvedType type = world.fromBinding(parameters[i]);
      // pr268710: allow for inner interfaces in a generic aspect
      if (parameters[i].isInterface() && parameters[i].isParameterizedType() && parameters[i].isMemberType()) {
        TypeVariableBinding[] tvs = parameters[i].typeVariables();
        if (tvs == null || tvs.length == 0) {
          type = type.getRawType();
        }
      }
      bindings[i] = new FormalBinding(type, name, i, arg.sourceStart, arg.sourceEnd);
    }
View Full Code Here

    // Look at erasures of parameters (List<String> erased is List)
    boolean sameParams = true;
    for (int p = 0, max = methodThatMightBeGettingOverridden.getParameterTypes().length; p < max; p++) {

      UnresolvedType mtmbgoParameter = methodThatMightBeGettingOverridden.getParameterTypes()[p];
      UnresolvedType ptype = methodParamsArray[p];

      if (mtmbgoParameter.isTypeVariableReference()) {
        if (!mtmbgoParameter.resolve(w).isAssignableFrom(ptype.resolve(w))) {
          sameParams = false;
        }
      } else {
        // old condition:
        boolean b = !methodThatMightBeGettingOverridden.getParameterTypes()[p].getErasureSignature().equals(
            methodParamsArray[p].getErasureSignature());

        UnresolvedType parameterType = methodThatMightBeGettingOverridden.getParameterTypes()[p];

        // Collapse to first bound (isn't that the same as erasure!
        if (parameterType instanceof UnresolvedTypeVariableReferenceType) {
          parameterType = ((UnresolvedTypeVariableReferenceType) parameterType).getTypeVariable().getFirstBound();
        }
View Full Code Here

      int memberLineNumber) {
    if (!getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) {
      StringBuffer parmString = new StringBuffer("(");
      UnresolvedType[] paramTypes = member.getParameterTypes();
      for (int i = 0; i < paramTypes.length; i++) {
        UnresolvedType type = paramTypes[i];
        String s = org.aspectj.apache.bcel.classfile.Utility.signatureToString(type.getSignature());
        if (s.lastIndexOf('.') != -1) {
          s = s.substring(s.lastIndexOf('.') + 1);
        }
        parmString.append(s);
        if ((i + 1) < paramTypes.length) {
View Full Code Here

   * @param rm the sig we want it to pretend to be 'int A.m()' or somesuch ITD like thing
   * @param declaredSig the real sig 'blah.ajc$xxx'
   */
  private void fixParameterNamesForResolvedMember(ResolvedMember rm, ResolvedMember declaredSig) {

    UnresolvedType memberHostType = declaredSig.getDeclaringType();
    String methodName = declaredSig.getName();
    String[] pnames = null;
    if (rm.getKind() == Member.METHOD && !rm.isAbstract()) {
      if (methodName.startsWith("ajc$inlineAccessMethod") || methodName.startsWith("ajc$superDispatch")) {
        ResolvedMember resolvedDooberry = world.resolve(declaredSig);
        pnames = resolvedDooberry.getParameterNames();
      } else {
        ResolvedMember realthing = AjcMemberMaker.interMethodDispatcher(rm.resolve(world), memberHostType).resolve(world);
        ResolvedMember theRealMember = findResolvedMemberNamed(memberHostType.resolve(world), realthing.getName());
        if (theRealMember != null) {
          pnames = theRealMember.getParameterNames();
          // static ITDs don't need any parameter shifting
          if (pnames.length > 0 && pnames[0].equals("ajc$this_")) {
            String[] pnames2 = new String[pnames.length - 1];
View Full Code Here

   * @param rm the sig we want it to pretend to be 'int A.m()' or somesuch ITD like thing
   * @param declaredSig the real sig 'blah.ajc$xxx'
   */
  private void fixAnnotationsForResolvedMember(ResolvedMember rm, ResolvedMember declaredSig) {
    try {
      UnresolvedType memberHostType = declaredSig.getDeclaringType();
      ResolvedType[] annotations = mapToAnnotations.get(rm);
      String methodName = declaredSig.getName();
      // FIXME asc shouldnt really rely on string names !
      if (annotations == null) {
        if (rm.getKind() == Member.FIELD) {
          if (methodName.startsWith("ajc$inlineAccessField")) {
            ResolvedMember resolvedDooberry = world.resolve(rm);
            annotations = resolvedDooberry.getAnnotationTypes();
          } else {
            ResolvedMember realthing = AjcMemberMaker.interFieldInitializer(rm, memberHostType);
            ResolvedMember resolvedDooberry = world.resolve(realthing);
            annotations = resolvedDooberry.getAnnotationTypes();
          }
        } else if (rm.getKind() == Member.METHOD && !rm.isAbstract()) {
          if (methodName.startsWith("ajc$inlineAccessMethod") || methodName.startsWith("ajc$superDispatch")) {
            ResolvedMember resolvedDooberry = world.resolve(declaredSig);
            annotations = resolvedDooberry.getAnnotationTypes();
          } else {
            ResolvedMember realthing = AjcMemberMaker.interMethodDispatcher(rm.resolve(world), memberHostType).resolve(
                world);
            // ResolvedMember resolvedDooberry =
            // world.resolve(realthing);
            ResolvedMember theRealMember = findResolvedMemberNamed(memberHostType.resolve(world), realthing.getName());
            // AMC temp guard for M4
            if (theRealMember == null) {
              throw new UnsupportedOperationException(
                  "Known limitation in M4 - can't find ITD members when type variable is used as an argument and has upper bound specified");
            }
            annotations = theRealMember.getAnnotationTypes();
          }
        } else if (rm.getKind() == Member.CONSTRUCTOR) {
          ResolvedMember realThing = AjcMemberMaker.postIntroducedConstructor(memberHostType.resolve(world),
              rm.getDeclaringType(), rm.getParameterTypes());
          ResolvedMember resolvedDooberry = world.resolve(realThing);
          // AMC temp guard for M4
          if (resolvedDooberry == null) {
            throw new UnsupportedOperationException(
View Full Code Here

          body.append(fact.createInvoke(rm.getDeclaringType().getName(), rm.getName(), rm.getSignature(),
              Constants.INVOKESTATIC));
          body.append(Utility.createSet(fact, munger.getDelegate(weaver.getLazyClassGen().getType())));
        } else {
          // Need to call aspectOf() to obtain the aspect instance then call the factory method upon that
          UnresolvedType theAspect = munger.getAspect();
          body.append(fact.createInvoke(theAspect.getName(), "aspectOf", "()" + theAspect.getSignature(),
              Constants.INVOKESTATIC));
          if (rm.getArity() != 0) {
            body.append(InstructionConstants.ALOAD_0);
          }
          body.append(fact.createInvoke(rm.getDeclaringType().getName(), rm.getName(), rm.getSignature(),
View Full Code Here

   * A heavyweight BcelMethod object is only required for around advice that will be inlined. For other kinds of advice it is
   * possible to save some space.
   */
  private static Member simplify(AdviceKind kind, Member adviceSignature) {
    if (adviceSignature != null) {
      UnresolvedType adviceDeclaringType = adviceSignature.getDeclaringType();
      // if it isnt around advice or it is but inlining is turned off then shrink it to a ResolvedMemberImpl
      if (kind != AdviceKind.Around
          || ((adviceDeclaringType instanceof ResolvedType) && ((ResolvedType) adviceDeclaringType).getWorld()
              .isXnoInline())) {
        if (adviceSignature instanceof BcelMethod) {
View Full Code Here

    if (getKind() == AdviceKind.Before) {
      shadow.weaveBefore(this);
    } else if (getKind() == AdviceKind.AfterReturning) {
      shadow.weaveAfterReturning(this);
    } else if (getKind() == AdviceKind.AfterThrowing) {
      UnresolvedType catchType = hasExtraParameter() ? getExtraParameterType() : UnresolvedType.THROWABLE;
      shadow.weaveAfterThrowing(this, catchType);
    } else if (getKind() == AdviceKind.After) {
      shadow.weaveAfter(this);
    } else if (getKind() == AdviceKind.Around) {
      // Note: under regular LTW the aspect is usually loaded after the first use of any class affecteted by it
View Full Code Here

    InstructionList il = new InstructionList();

    // we test to see if we have the right kind of thing...
    // after throwing does this just by the exception mechanism.
    if (hasExtraParameter() && getKind() == AdviceKind.AfterReturning) {
      UnresolvedType extraParameterType = getExtraParameterType();
      if (!extraParameterType.equals(UnresolvedType.OBJECT) && !extraParameterType.isPrimitiveType()) {
        il.append(BcelRenderer.renderTest(fact, world,
            Test.makeInstanceof(extraArgVar, getExtraParameterType().resolve(world)), null, ifNoAdvice, null));
      }
    }
    il.append(getAdviceArgSetup(shadow, extraArgVar, null));
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.UnresolvedType

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.