Examples of UnresolvedType


Examples of org.aspectj.weaver.UnresolvedType

            // try to avoid verify error and pass in null
            il.append(InstructionConstants.ACONST_NULL);
          }
        }
      } else {
        UnresolvedType desiredTy = getBindingParameterTypes()[i];
        v.appendLoadAndConvert(il, fact, desiredTy.resolve(world));
      }
    }

    // ATAJ: for code style aspect, handles the extraFlag as usual ie not
    // in the middle of the formal bindings but at the end, in a rock solid ordering
View Full Code Here

Examples of org.aspectj.weaver.UnresolvedType

      return match;
    }
    // are we dealing with array funkyness - pattern might be jlObject[]+ and type jlString[]
    if (type.isArray() && this.type.isArray()) {
      ResolvedType componentType = type.getComponentType().resolve(type.getWorld());
      UnresolvedType newPatternType = this.type.getComponentType();
      ExactTypePattern etp = new ExactTypePattern(newPatternType, includeSubtypes, false);
      return etp.matchesSubtypes(componentType, type);
    }
    return match;
  }
View Full Code Here

Examples of org.aspectj.weaver.UnresolvedType

  protected boolean couldEverMatchSameTypesAs(TypePattern other) {
    if (super.couldEverMatchSameTypesAs(other)) {
      return true;
    }
    // false is necessary but not sufficient
    UnresolvedType otherType = other.getExactType();
    if (!ResolvedType.isMissing(otherType)) {
      return type.equals(otherType);
    }
    if (other instanceof WildTypePattern) {
      WildTypePattern owtp = (WildTypePattern) other;
View Full Code Here

Examples of org.aspectj.weaver.UnresolvedType

  /**
   * return a version of this type pattern with all type variables references replaced by the corresponding entry in the map.
   */
  @Override
  public TypePattern parameterizeWith(Map typeVariableMap, World w) {
    UnresolvedType newType = type;
    if (type.isTypeVariableReference()) {
      TypeVariableReference t = (TypeVariableReference) type;
      String key = t.getTypeVariable().getName();
      if (typeVariableMap.containsKey(key)) {
        newType = (UnresolvedType) typeVariableMap.get(key);
View Full Code Here

Examples of org.aspectj.weaver.UnresolvedType

      inlineAccessorMethodGens.add(method);

      InstructionList il = method.getBody();
      int register = 0;
      for (int i = 0; i < inlineAccessor.getParameterTypes().length; i++) {
        UnresolvedType typeX = inlineAccessor.getParameterTypes()[i];
        Type type = BcelWorld.makeBcelType(typeX);
        il.append(InstructionFactory.createLoad(type, register));
        register += type.getSize();
      }
      il.append(Utility.createInvoke(factory, Modifier.isStatic(resolvedMember.getModifiers()) ? Constants.INVOKESTATIC
View Full Code Here

Examples of org.aspectj.weaver.UnresolvedType

      InstructionList il = method.getBody();
      il.append(InstructionConstants.ALOAD_0);
      int register = 1;
      for (int i = 0; i < inlineAccessor.getParameterTypes().length; i++) {
        UnresolvedType typeX = inlineAccessor.getParameterTypes()[i];
        Type type = BcelWorld.makeBcelType(typeX);
        il.append(InstructionFactory.createLoad(type, register));
        register += type.getSize();
      }
      il.append(Utility.createInvoke(factory, Constants.INVOKESPECIAL, resolvedMember));
View Full Code Here

Examples of org.aspectj.weaver.UnresolvedType

                getSourceLocation()));
        return Literal.TRUE; // exit quickly, error will prevent weaving
      }
      BindingAnnotationFieldTypePattern btp = (BindingAnnotationFieldTypePattern) annotationTypePattern;
      ResolvedType formalType = btp.getFormalType().resolve(shadow.getIWorld());
      UnresolvedType annoType = btp.getAnnotationType();
      // TODO 2 need to sort out appropriate creation of the AnnotationAccessFieldVar - what happens for
      // reflective (ReflectionShadow) access to types?
      Var var = shadow.getKindedAnnotationVar(annoType);
      if (var == null) {
        throw new BCException("Unexpected problem locating annotation at join point '" + shadow + "'");
      }
      state.set(btp.getFormalIndex(), var.getAccessorForValue(formalType));
    } else if (annotationTypePattern instanceof BindingAnnotationTypePattern) {
      BindingAnnotationTypePattern btp = (BindingAnnotationTypePattern) annotationTypePattern;
      UnresolvedType annotationType = btp.getAnnotationType();
      Var var = shadow.getKindedAnnotationVar(annotationType);

      // At this point, var *could* be null. The only reason this could happen (if we aren't failing...)
      // is if another binding annotation designator elsewhere in the pointcut is going to expose the annotation
      // eg. (execution(* a*(..)) && @annotation(foo)) || (execution(* b*(..)) && @this(foo))
View Full Code Here

Examples of org.aspectj.weaver.UnresolvedType

    ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_DECLARE_ANNOTATIONS,
        sourceType.sourceName);

    // Get the annotation specified in the declare
    UnresolvedType aspectType = decA.getAspect();
    if (aspectType instanceof ReferenceType) {
      ReferenceType rt = (ReferenceType) aspectType;
      if (rt.isParameterizedType() || rt.isRawType()) {
        aspectType = rt.getGenericType();
      }
    }
    TypeBinding tb = factory.makeTypeBinding(aspectType);

    // Hideousness follows:

    // There are multiple situations to consider here and they relate to the
    // combinations of
    // where the annotation is coming from and where the annotation is going
    // to be put:
    //
    // 1. Straight full build, all from source - the annotation is from a
    // dec@type and
    // is being put on some type. Both types are real SourceTypeBindings.
    // WORKS
    // 2. Incremental build, changing the affected type - the annotation is
    // from a
    // dec@type in a BinaryTypeBinding (so has to be accessed via bcel) and
    // the
    // affected type is a real SourceTypeBinding. Mostly works (pr128665)
    // 3. ?

    SourceTypeBinding stb = (SourceTypeBinding) tb;
    Annotation[] toAdd = null;
    long abits = 0;

    AbstractMethodDeclaration methodDecl = null;
    // Might have to retrieve the annotation through BCEL and construct an
    // eclipse one for it.
    if (stb instanceof BinaryTypeBinding) {
      toAdd = retrieveAnnotationFromBinaryTypeBinding(decA, stb);
      if (toAdd != null && toAdd.length > 0 && toAdd[0].resolvedType != null) {
        abits = toAdd[0].resolvedType.getAnnotationTagBits();
      }
    } else if (stb != null) {
      // much nicer, its a real SourceTypeBinding so we can stay in
      // eclipse land
      // if (decA.getAnnotationMethod() != null) {
      char[] declareSelector = decA.getAnnotationMethod().toCharArray();

      ReferenceBinding rb = stb;
      String declaringAspectName = decA.getDeclaringType().getRawName();
      while (rb != null && !new String(CharOperation.concatWith(rb.compoundName, '.')).equals(declaringAspectName)) {
        rb = rb.superclass();
      }
      MethodBinding[] mbs = rb.getMethods(declareSelector);

      ReferenceBinding declaringBinding = mbs[0].declaringClass;
      if (declaringBinding instanceof ParameterizedTypeBinding) {
        // Unwrap - this means we don't allow the type of the annotation to be parameterized, may need to revisit that
        declaringBinding = ((ParameterizedTypeBinding) declaringBinding).type;
      }
      if (declaringBinding instanceof BinaryTypeBinding) {
        toAdd = retrieveAnnotationFromBinaryTypeBinding(decA, declaringBinding);
        if (toAdd != null && toAdd.length > 0 && toAdd[0].resolvedType != null) {
          abits = toAdd[0].resolvedType.getAnnotationTagBits();
        }
      } else {
        abits = mbs[0].getAnnotationTagBits(); // ensure resolved
        TypeDeclaration typeDecl = ((SourceTypeBinding) declaringBinding).scope.referenceContext;
        methodDecl = typeDecl.declarationOf(mbs[0]);
        toAdd = methodDecl.annotations; // this is what to add
        toAdd[0] = createAnnotationCopy(toAdd[0]);
        if (toAdd[0].resolvedType != null) {
          abits = toAdd[0].resolvedType.getAnnotationTagBits();
          // }
        }
      }
    }

    // This happens if there is another error in the code - that should be reported separately
    if (toAdd == null || toAdd[0] == null || toAdd[0].type == null) {
      CompilationAndWeavingContext.leavingPhase(tok);
      return false;
    }
    if (sourceType instanceof BinaryTypeBinding) {
      // In this case we can't access the source type binding to add a new
      // annotation, so let's put something
      // on the weaver type temporarily
      ResolvedType theTargetType = factory.fromEclipse(sourceType);
      TypeBinding theAnnotationType = toAdd[0].resolvedType;
      // The annotation type may be null if it could not be resolved (eg. the relevant import has not been added yet)
      // In this case an error will be put out about the annotation but not if we crash here
      if (theAnnotationType == null) {
        return false;
      }
      String sig = new String(theAnnotationType.signature());
      UnresolvedType bcelAnnotationType = UnresolvedType.forSignature(sig);
      String name = bcelAnnotationType.getName();
      if (theTargetType.hasAnnotation(bcelAnnotationType)) {
        CompilationAndWeavingContext.leavingPhase(tok);
        return false;
      }
View Full Code Here

Examples of org.aspectj.weaver.UnresolvedType

    annotationType = scope.getWorld().resolve(annotationType, true);

    // May not be directly found if in a package, so go looking if that is the case:
    if (ResolvedType.isMissing(annotationType)) {
      String cleanname = annotationType.getName();
      UnresolvedType type = null;
      while (ResolvedType.isMissing(type = scope.lookupType(cleanname, this))) {
        int lastDot = cleanname.lastIndexOf('.');
        if (lastDot == -1) {
          break;
        }
View Full Code Here

Examples of org.aspectj.weaver.UnresolvedType

  }

  public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
    ExactAnnotationFieldTypePattern ret;
    String formalName = s.readUTF();
    UnresolvedType annotationType = UnresolvedType.read(s);
    ret = new ExactAnnotationFieldTypePattern(annotationType, formalName);
    ret.readLocation(context, s);
    return ret;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.