Package org.aspectj.weaver

Examples of org.aspectj.weaver.ReferenceType


      }
    }

    // handle the perClause
    ReferenceType rt = new ReferenceType(ResolvedType.forName(concreteAspect.name).getSignature(), world);
    GeneratedReferenceTypeDelegate grtd = new GeneratedReferenceTypeDelegate(rt);
    grtd.setSuperclass(parent);
    rt.setDelegate(grtd);

    BcelPerClauseAspectAdder perClauseMunger = new BcelPerClauseAspectAdder(rt, perclauseKind);
    perClauseMunger.forceMunge(cg, false);

    // TODO AV - unsafe cast
View Full Code Here


      exceptionText.append("Found invalid (not a ReferenceType) entry in the type map. ");
      exceptionText.append("Signature=[" + signature + "] Found=[" + fromTheMap + "] Class=[" + fromTheMap.getClass() + "]");
      throw new BCException(exceptionText.toString());
    }

    ReferenceType nameTypeX = (ReferenceType) fromTheMap;

    if (nameTypeX == null) {
      if (jc.isGeneric() && isInJava5Mode()) {
        nameTypeX = ReferenceType.fromTypeX(UnresolvedType.forRawTypeName(jc.getClassName()), this);
        ret = buildBcelDelegate(nameTypeX, jc, artificial, true);
        ReferenceType genericRefType = new ReferenceType(UnresolvedType.forGenericTypeSignature(signature,
            ret.getDeclaredGenericSignature()), this);
        nameTypeX.setDelegate(ret);
        genericRefType.setDelegate(ret);
        nameTypeX.setGenericType(genericRefType);
        typeMap.put(signature, nameTypeX);
      } else {
        nameTypeX = new ReferenceType(signature, this);
        ret = buildBcelDelegate(nameTypeX, jc, artificial, true);
        typeMap.put(signature, nameTypeX);
      }
    } else {
      ret = buildBcelDelegate(nameTypeX, jc, artificial, true);
View Full Code Here

      exceptionText.append("Found invalid (not a ReferenceType) entry in the type map. ");
      exceptionText.append("Signature=[" + signature + "] Found=[" + fromTheMap + "] Class=[" + fromTheMap.getClass() + "]");
      throw new BCException(exceptionText.toString());
    }

    ReferenceType nameTypeX = (ReferenceType) fromTheMap;

    if (nameTypeX == null) {
      JavaClass jc = Utility.makeJavaClass(classname, bytes);
      if (jc.isGeneric() && isInJava5Mode()) {
        nameTypeX = ReferenceType.fromTypeX(UnresolvedType.forRawTypeName(jc.getClassName()), this);
        ret = buildBcelDelegate(nameTypeX, jc, artificial, true);
        ReferenceType genericRefType = new ReferenceType(UnresolvedType.forGenericTypeSignature(signature,
            ret.getDeclaredGenericSignature()), this);
        nameTypeX.setDelegate(ret);
        genericRefType.setDelegate(ret);
        nameTypeX.setGenericType(genericRefType);
        typeMap.put(signature, nameTypeX);
      } else {
        nameTypeX = new ReferenceType(signature, this);
        ret = buildBcelDelegate(nameTypeX, jc, artificial, true);
        typeMap.put(signature, nameTypeX);
      }
    } else {
      Object o = nameTypeX.getDelegate();
View Full Code Here

        }
      }
    }

    if (hasPointcuts || dec instanceof AspectDeclaration || couldBeAnnotationStyleAspectDeclaration(dec)) {
      ReferenceType name = (ReferenceType) factory.fromEclipse(sourceType);
      EclipseSourceType eclipseSourceType = (EclipseSourceType) name.getDelegate();
      eclipseSourceType.checkPointcutDeclarations();
    }

    ReferenceBinding[] memberTypes = sourceType.memberTypes;
    for (int i = 0, length = memberTypes.length; i < length; i++) {
View Full Code Here

        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:
View Full Code Here

    }
    return true;
  }

  private Annotation[] retrieveAnnotationFromBinaryTypeBinding(DeclareAnnotation decA, ReferenceBinding declaringBinding) {
    ReferenceType rt = (ReferenceType) factory.fromEclipse(declaringBinding);
    ResolvedMember[] methods = rt.getDeclaredMethods();
    ResolvedMember decaMethod = null;
    String nameToLookFor = decA.getAnnotationMethod();
    for (int i = 0; i < methods.length; i++) {
      if (methods[i].getName().equals(nameToLookFor)) {
        decaMethod = methods[i];
View Full Code Here

    }

    // also add it to the bcel delegate if there is one
    if (sourceType instanceof BinaryTypeBinding) {
      ResolvedType onType = factory.fromEclipse(sourceType);
      ReferenceType rt = (ReferenceType) onType;
      ReferenceTypeDelegate rtd = rt.getDelegate();
      if (rtd instanceof BcelObjectType) {
        rt.addParent(parent);
        // ((BcelObjectType) rtd).addParent(parent);
      }
    }

  }
View Full Code Here

          + formalBinding.getType() + "' is not (compiler limitation)");
    }
    bindingPattern = true;

    // Check that the formal is bound to a type that is represented by one field in the annotation type
    ReferenceType theAnnotationType = (ReferenceType) annotationType;
    ResolvedMember[] annotationFields = theAnnotationType.getDeclaredMethods();
    field = null;
    for (int i = 0; i < annotationFields.length; i++) {
      ResolvedMember resolvedMember = annotationFields[i];
      if (resolvedMember.getReturnType().equals(formalBinding.getType())) {
        if (field != null) {
          scope.message(IMessage.ERROR, this, "The field type '" + formalBinding.getType()
              + "' is ambiguous for annotation type '" + theAnnotationType.getName() + "'");
        }
        field = resolvedMember;
      }
    }
    if (field == null) {
      scope.message(IMessage.ERROR, this, "No field of type '" + formalBinding.getType() + "' exists on annotation type '"
          + theAnnotationType.getName() + "'");
    }

    BindingAnnotationFieldTypePattern binding = new BindingAnnotationFieldTypePattern(formalBinding.getType(), formalBinding
        .getIndex(), theAnnotationType);
    binding.copyLocationFrom(this);
View Full Code Here

      }
    } else {
      simpleTx = UnresolvedType.forName(getName(binding));
    }

    ReferenceType name = getWorld().lookupOrCreateName(simpleTx);

    // A type can change from simple > generic > simple across a set of compiles. We need
    // to ensure the entry in the typemap is promoted and demoted correctly. The call
    // to setGenericType() below promotes a simple to a raw. This call demotes it back
    // to simple
    // pr125405
    if (!binding.isRawType() && !binding.isGenericType() && name.getTypekind() == TypeKind.RAW) {
      name.demoteToSimpleType();
    }

    EclipseSourceType t = new EclipseSourceType(name, this, binding, decl, unit);

    // For generics, go a bit further - build a typex for the generic type
    // give it the same delegate and link it to the raw type
    if (binding.isGenericType()) {
      UnresolvedType complexTx = fromBinding(binding); // fully aware of any generics info
      ResolvedType cName = world.resolve(complexTx, true);
      ReferenceType complexName = null;
      if (!cName.isMissing()) {
        complexName = (ReferenceType) cName;
        complexName = (ReferenceType) complexName.getGenericType();
        if (complexName == null) {
          complexName = new ReferenceType(complexTx, world);
        }
      } else {
        complexName = new ReferenceType(complexTx, world);
      }
      name.setGenericType(complexName);
      complexName.setDelegate(t);
    }

    name.setDelegate(t);
    if (decl instanceof AspectDeclaration) {
      ((AspectDeclaration) decl).typeX = name;
View Full Code Here

      }
      return annoAJs;
    } else {
      UnresolvedType declaringType = this.getDeclaringType();
      if (declaringType instanceof ReferenceType) {
        ReferenceType referenceDeclaringType = (ReferenceType) declaringType;
        if (referenceDeclaringType.getDelegate() instanceof BcelObjectType) {
          // worth a look!
          ResolvedMember field = ((ResolvedType) declaringType).lookupField(this);
          if (field != null) {
            return field.getAnnotations();
          }
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.ReferenceType

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.