Package org.aspectj.weaver

Examples of org.aspectj.weaver.UnresolvedType$TypeKind


       * Java language keyword corresponding to the primitive type or void. 3. If this class object represents a class of
       * arrays, then the internal form of the name consists of the name of the element type preceded by one or more '['
       * characters representing the depth of the array nesting.
       */
      if (clazz.isArray()) {
        UnresolvedType ut = UnresolvedType.forSignature(name.replace('.', '/'));
        return getWorld().resolve(ut);
      } else {
        return getWorld().resolve(name);
      }
    } else if (aType instanceof ParameterizedType) {
View Full Code Here


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

   * @param advice
   * @return
   */
  private BcelVar insertAdviceInstructionsForBindingReturningParameter(InstructionList advice) {
    BcelVar tempVar;
    UnresolvedType tempVarType = getReturnType();
    if (tempVarType.equals(ResolvedType.VOID)) {
      tempVar = genTempVar(UnresolvedType.OBJECT);
      advice.append(InstructionConstants.ACONST_NULL);
      tempVar.appendStore(advice, getFactory());
    } else {
      tempVar = genTempVar(tempVarType);
      advice.append(InstructionFactory.createDup(tempVarType.getSize()));
      tempVar.appendStore(advice, getFactory());
    }
    return tempVar;
  }
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()),
          // "",IMessage.ERROR,getSourceLocation(),null,
          // new ISourceLocation[]{ munger.getSourceLocation()});
          // world.getMessageHandler().handleMessage(msg);
        }
        stateTempVar.appendConvertableArrayLoad(returnConversionCode, fact, i, stateRTX);
      }
    } else {
      // pr226201
      Member mungerSignature = munger.getSignature();
      if (munger.getSignature() instanceof ResolvedMember) {
        if (((ResolvedMember) mungerSignature).hasBackingGenericMember()) {
          mungerSignature = ((ResolvedMember) mungerSignature).getBackingGenericMember();
        }
      }
      UnresolvedType returnType = mungerSignature.getReturnType();
      returnConversionCode = Utility.createConversion(getFactory(), BcelWorld.makeBcelType(returnType), callbackMethod
          .getReturnType(), world.isInJava5Mode());
      if (!isFallsThrough()) {
        returnConversionCode.append(InstructionFactory.createReturn(callbackMethod.getReturnType()));
      }
View Full Code Here

        oldi++;
        newi += 1;
      }
      // assert targetVar == thisVar
      for (int i = 0; i < getArgCount(); i++) {
        UnresolvedType type = getArgType(i);
        ret.put(oldi, newi);
        oldi += type.getSize();
        newi += type.getSize();
      }
    }

    // System.err.println("making remap for : " + this);
    // if (targetVar != null) System.err.println("target slot : " + targetVar.getSlot());
View Full Code Here

   */
  private LazyMethodGen createShadowMethodGen(String newMethodName, int visibilityModifier, List<String> parameterNames) {
    Type[] shadowParameterTypes = BcelWorld.makeBcelTypes(getArgTypes());
    int modifiers = Modifier.FINAL | Modifier.STATIC | visibilityModifier;
    if (targetVar != null && targetVar != thisVar) {
      UnresolvedType targetType = getTargetType();
      targetType = ensureTargetTypeIsCorrect(targetType);
      // see pr109728,pr229910 - this fixes the case when the declaring class is sometype 'X' but the (gs)etfield
      // in the bytecode refers to a subtype of 'X'. This makes sure we use the type originally
      // mentioned in the fieldget instruction as the method parameter and *not* the type upon which the
      // field is declared because when the instructions are extracted into the new around body,
      // they will still refer to the subtype.
      if ((getKind() == FieldGet || getKind() == FieldSet) && getActualTargetType() != null
          && !getActualTargetType().equals(targetType.getName())) {
        targetType = UnresolvedType.forName(getActualTargetType()).resolve(world);
      }
      ResolvedMember resolvedMember = getSignature().resolve(world);

      // pr230075, pr197719
      if (resolvedMember != null && Modifier.isProtected(resolvedMember.getModifiers())
          && !samePackage(resolvedMember.getDeclaringType().getPackageName(), getEnclosingType().getPackageName())
          && !resolvedMember.getName().equals("clone")) {
        if (!hasThis()) { // pr197719 - static accessor has been created to handle the call
          if (Modifier.isStatic(enclosingMethod.getAccessFlags()) && enclosingMethod.getName().startsWith("access$")) {
            targetType = BcelWorld.fromBcel(enclosingMethod.getArgumentTypes()[0]);
          }
        } else {
          if (!targetType.resolve(world).isAssignableFrom(getThisType().resolve(world))) {
            throw new BCException("bad bytecode");
          }
          targetType = getThisType();
        }
      }
      parameterNames.add("target");
      // There is a 'target' and it is not the same as 'this', so add it to the parameter list
      shadowParameterTypes = addTypeToFront(BcelWorld.makeBcelType(targetType), shadowParameterTypes);
    }

    if (thisVar != null) {
      UnresolvedType thisType = getThisType();
      parameterNames.add(0, "ajc$this");
      shadowParameterTypes = addTypeToFront(BcelWorld.makeBcelType(thisType), shadowParameterTypes);
    }

    if (this.getKind() == Shadow.FieldSet || this.getKind() == Shadow.FieldGet) {
      parameterNames.add(getSignature().getName());
    } else {
      String[] pnames = getSignature().getParameterNames(world);
      if (pnames != null) {
        for (int i = 0; i < pnames.length; i++) {
          if (i == 0 && pnames[i].equals("this")) {
            parameterNames.add("ajc$this");
          } else {
            parameterNames.add(pnames[i]);
          }
        }
      }
    }

    // We always want to pass down thisJoinPoint in case we have already woven
    // some advice in here. If we only have a single piece of around advice on a
    // join point, it is unnecessary to accept (and pass) tjp.
    if (thisJoinPointVar != null) {
      parameterNames.add("thisJoinPoint");
      shadowParameterTypes = addTypeToEnd(LazyClassGen.tjpType, shadowParameterTypes);
    }

    UnresolvedType returnType;
    if (getKind() == PreInitialization) {
      returnType = UnresolvedType.OBJECTARRAY;
    } else {
      if (getKind() == ConstructorCall) {
        returnType = getSignature().getDeclaringType();
View Full Code Here

      kind = Constants.INVOKESPECIAL;
    } else {
      kind = Constants.INVOKEVIRTUAL;
    }

    UnresolvedType targetType = signature.getDeclaringType();
    if (targetType.isParameterizedType()) {
      targetType = targetType.resolve(world).getGenericType();
    }
    return fact.createInvoke(targetType.getName(), signature.getName(), BcelWorld.makeBcelType(signature.getReturnType()),
        BcelWorld.makeBcelTypes(signature.getParameterTypes()), kind);
  }
View Full Code Here

  public static boolean isSuppressing(Member member, String lintkey) {
    boolean isSuppressing = Utils.isSuppressing(member.getAnnotations(), lintkey);
    if (isSuppressing) {
      return true;
    }
    UnresolvedType type = member.getDeclaringType();
    if (type instanceof ResolvedType) {
      return Utils.isSuppressing(((ResolvedType) type).getAnnotations(), lintkey);
    }
    return false;
  }
View Full Code Here

        return false;
      }
      if (parent.isParameterizedType()) {
        UnresolvedType[] typeParameters = parent.getTypeParameters();
        for (int i = 0; i < typeParameters.length; i++) {
          UnresolvedType typeParameter = typeParameters[i];
          if (typeParameter instanceof ResolvedType && ((ResolvedType) typeParameter).isMissing()) {
            reportError("Unablet to resolve type parameter '" + typeParameter.getName() + "' from " + stringify());
            return false;
          }
        }
      }
    } else {
View Full Code Here

      Member actualEnclosingMember = ((BcelShadow) shadow).getRealEnclosingCodeSignature();

      if (actualEnclosingMember == null) {
        enclosingNode = lookupMember(model.getHierarchy(), shadow.getEnclosingType(), enclosingMember);
      } else {
        UnresolvedType type = enclosingMember.getDeclaringType();
        UnresolvedType actualType = actualEnclosingMember.getDeclaringType();

        // if these are not the same, it is an ITD and we need to use
        // the latter to lookup
        if (type.equals(actualType)) {
          enclosingNode = lookupMember(model.getHierarchy(), shadow.getEnclosingType(), enclosingMember);
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.UnresolvedType$TypeKind

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.