Package org.aspectj.weaver

Examples of org.aspectj.weaver.UnresolvedType


      // stack into a local variable slot. This is a trimmed version of
      // what is in initializeArgVars() (since there is only one argument
      // at a handler jp and only before advice is supported) (pr46298)
      argVars = new BcelVar[1];
      // int positionOffset = (hasTarget() ? 1 : 0) + ((hasThis() && !getKind().isTargetSameAsThis()) ? 1 : 0);
      UnresolvedType tx = getArgType(0);
      argVars[0] = genTempVar(tx, "ajc$arg0");
      InstructionHandle insertedInstruction = range.insert(argVars[0].createStore(getFactory()), Range.OutsideBefore);

      // Now the exception range starts just after our new instruction.
      // The next bit of code changes the exception range to point at
View Full Code Here


   */

  public static BcelShadow makeExceptionHandler(BcelWorld world, ExceptionRange exceptionRange, LazyMethodGen enclosingMethod,
      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);
View Full Code Here

        initializeThisVar();
      }
      targetVar = thisVar;
    } else {
      initializeArgVars(); // gotta pop off the args before we find the target
      UnresolvedType type = getTargetType();
      type = ensureTargetTypeIsCorrect(type);
      targetVar = genTempVar(type, "ajc$target");
      range.insert(targetVar.createStore(fact), Range.OutsideBefore);
      targetVar.setPositionInAroundState(hasThis() ? 1 : 0);
    }
View Full Code Here

    if (getKind().argsOnStack()) {
      // Let's just do them all now since they are on the stack
      // we move backwards because we're popping off the stack
      for (int i = len - 1; i >= 0; i--) {
        UnresolvedType type = getArgType(i);
        BcelVar tmp = genTempVar(type, "ajc$arg" + i);
        range.insert(tmp.createStore(getFactory()), Range.OutsideBefore);
        int position = i;
        position += positionOffset;
        tmp.setPositionInAroundState(position);
        argVars[i] = tmp;
      }
      allArgVarsInitialized = true;
    } else {
      int index = 0;
      if (arg0HoldsThis()) {
        index++;
      }
      boolean allInited = true;
      for (int i = 0; i < len; i++) {
        UnresolvedType type = getArgType(i);
        if (i == argNumber) {
          argVars[argNumber] = genTempVar(type, "ajc$arg" + argNumber);
          range.insert(argVars[argNumber].createCopyFrom(fact, index), Range.OutsideBefore);
          argVars[argNumber].setPositionInAroundState(argNumber + positionOffset);
        }
        allInited = allInited && argVars[i] != null;
        index += type.getSize();
      }
      if (allInited && (argNumber + 1) == len) {
        allArgVarsInitialized = true;
      }
    }
View Full Code Here

    int positionOffset = (hasTarget() ? 1 : 0) + ((hasThis() && !getKind().isTargetSameAsThis()) ? 1 : 0);

    if (getKind().argsOnStack()) {
      // we move backwards because we're popping off the stack
      for (int i = len - 1; i >= 0; i--) {
        UnresolvedType type = getArgType(i);
        BcelVar tmp = genTempVar(type, "ajc$arg" + i);
        range.insert(tmp.createStore(getFactory()), Range.OutsideBefore);
        int position = i;
        position += positionOffset;
        tmp.setPositionInAroundState(position);
        argVars[i] = tmp;
      }
    } else {
      int index = 0;
      if (arg0HoldsThis()) {
        index++;
      }

      for (int i = 0; i < len; i++) {
        UnresolvedType type = getArgType(i);
        if (argVars[i] == null) {
          BcelVar tmp = genTempVar(type, "ajc$arg" + i);
          range.insert(tmp.createCopyFrom(fact, index), Range.OutsideBefore);
          argVars[i] = tmp;
          tmp.setPositionInAroundState(i + positionOffset);
        }
        index += type.getSize();
      }
    }
    allArgVarsInitialized = true;

  }
View Full Code Here

        String kindOfDP = null;
        StringBuffer details = new StringBuffer("");
        TypePattern[] newParents = dp.getParents().getTypePatterns();
        for (int i = 0; i < newParents.length; i++) {
          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

  }

  public String genTypePatternLabel(TypePattern tp) {
    final String TYPE_PATTERN_LITERAL = "<type pattern>";
    String label;
    UnresolvedType typeX = tp.getExactType();

    if (!ResolvedType.isMissing(typeX)) {
      label = typeX.getName();
      if (tp.isIncludeSubtypes()) {
        label += "+";
      }
    } else {
      label = TYPE_PATTERN_LITERAL;
View Full Code Here

    FormalBinding[] ret = new FormalBinding[mDecl.arguments.length];
    for (int i = 0; i < mDecl.arguments.length; i++) {
      Argument arg = mDecl.arguments[i];
      String name = new String(arg.name);
      TypeBinding argTypeBinding = mDecl.binding.parameters[i];
      UnresolvedType type = factory.fromBinding(argTypeBinding);
      if (CharOperation.equals(joinPoint, argTypeBinding.signature())
          || CharOperation.equals(joinPointStaticPart, argTypeBinding.signature())
          || CharOperation.equals(joinPointEnclosingStaticPart, argTypeBinding.signature())
          || CharOperation.equals(proceedingJoinPoint, argTypeBinding.signature()) || name.equals(extraArgName)) {
        ret[i] = new FormalBinding.ImplicitFormalBinding(type, name, i);
View Full Code Here

  }

  private TypeVariable typeParameter2TypeVariable(TypeParameter typeParameter) {
    String name = new String(typeParameter.name);
    ReferenceBinding superclassBinding = typeParameter.binding.superclass;
    UnresolvedType superclass = UnresolvedType.forSignature(new String(superclassBinding.signature()));
    UnresolvedType[] superinterfaces = null;
    ReferenceBinding[] superInterfaceBindings = typeParameter.binding.superInterfaces;
    if (superInterfaceBindings != null) {
      superinterfaces = new UnresolvedType[superInterfaceBindings.length];
      for (int i = 0; i < superInterfaceBindings.length; i++) {
View Full Code Here

    Member retval = null;

    if (i.opcode == Constants.ANEWARRAY) {
      // ANEWARRAY arrayInstruction = (ANEWARRAY)i;
      Type ot = i.getType(cpg);
      UnresolvedType ut = fromBcel(ot);
      ut = UnresolvedType.makeArray(ut, 1);
      retval = MemberImpl.method(ut, Modifier.PUBLIC, ResolvedType.VOID, "<init>", new ResolvedType[] { ResolvedType.INT });
    } else if (i instanceof MULTIANEWARRAY) {
      MULTIANEWARRAY arrayInstruction = (MULTIANEWARRAY) i;
      UnresolvedType ut = null;
      short dimensions = arrayInstruction.getDimensions();
      ObjectType ot = arrayInstruction.getLoadClassType(cpg);
      if (ot != null) {
        ut = fromBcel(ot);
        ut = UnresolvedType.makeArray(ut, dimensions);
      } else {
        Type t = arrayInstruction.getType(cpg);
        ut = fromBcel(t);
      }
      ResolvedType[] parms = new ResolvedType[dimensions];
      for (int ii = 0; ii < dimensions; ii++) {
        parms[ii] = ResolvedType.INT;
      }
      retval = MemberImpl.method(ut, Modifier.PUBLIC, ResolvedType.VOID, "<init>", parms);

    } else if (i.opcode == Constants.NEWARRAY) {
      // NEWARRAY arrayInstruction = (NEWARRAY)i;
      Type ot = i.getType();
      UnresolvedType ut = fromBcel(ot);
      retval = MemberImpl.method(ut, Modifier.PUBLIC, ResolvedType.VOID, "<init>", new ResolvedType[] { ResolvedType.INT });
    } else {
      throw new BCException("Cannot create array construction signature for this non-array instruction:" + i);
    }
    return retval;
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.