Package org.aspectj.weaver

Examples of org.aspectj.weaver.ResolvedType


  }

  public void warnOnAddedInterface(ResolvedType type, ResolvedType parent) {
    World world = factory.getWorld();
    ResolvedType serializable = world.getCoreType(UnresolvedType.SERIALIZABLE);
    if (serializable.isAssignableFrom(type) && !serializable.isAssignableFrom(parent)
        && !LazyClassGen.hasSerialVersionUIDField(type)) {
      world.getLint().needsSerialVersionUIDField.signal(new String[] { type.getName().toString(),
          "added interface " + parent.getName().toString() }, null, null);
    }
  }
View Full Code Here


      List<ExactTypePattern> newParents = additionalParents.get(sourceTypeBinding);
      StringBuffer extendsString = new StringBuffer();
      StringBuffer implementsString = new StringBuffer();
      if (newParents != null && newParents.size() > 0) {
        for (ExactTypePattern newParent : newParents) {
          ResolvedType newParentType = newParent.getExactType().resolve(world);
          if (newParentType.isInterface()) {
            if (implementsString.length() > 0) {
              implementsString.append(",");
            }
            implementsString.append(newParentType.getName());
          } else {
            extendsString.append(newParentType.getName());
          }
        }
        if (trs == null && sr == null) {
          // nothing after the class declaration, let's insert what we need to
          // Find the position just before the type opening '{'
View Full Code Here

    boolean accept;
    try {
      ensureDelegateInitialized(className, bytes);

      ResolvedType classInfo = delegateForCurrentClass.getResolvedTypeX();

      // exclude are "AND"ed
      for (TypePattern typePattern : excludeTypePattern) {
        if (typePattern.matchesStatically(classInfo)) {
          // exclude match - skip
View Full Code Here

        return true;
      }
    }

    // needs further analysis
    ResolvedType classInfo = weaver.getWorld().resolve(UnresolvedType.forName(aspectClassName), true);
    // exclude are "AND"ed
    for (Iterator iterator = m_aspectExcludeTypePattern.iterator(); iterator.hasNext();) {
      TypePattern typePattern = (TypePattern) iterator.next();
      if (typePattern.matchesStatically(classInfo)) {
        // exclude match - skip
View Full Code Here

    if (m_dumpTypePattern.isEmpty()) {
      return false;
    }

    // TODO AV - optimize for className.startWith only
    ResolvedType classInfo = weaver.getWorld().resolve(UnresolvedType.forName(className), true);
    // dump
    for (Iterator iterator = m_dumpTypePattern.iterator(); iterator.hasNext();) {
      TypePattern typePattern = (TypePattern) iterator.next();
      if (typePattern.matchesStatically(classInfo)) {
        // dump match
View Full Code Here

      }
    }

    verifyIsAnnotationType((ResolvedType) annotationType, scope);

    ResolvedType formalBindingType = formalBinding.getType().resolve(scope.getWorld());

    if (!(formalBindingType.isEnum() || formalBindingType.getSignature().equals("Ljava/lang/String;"))) {
      scope.message(IMessage.ERROR, this, "The field within the annotation must be an enum or string. '"
          + formalBinding.getType() + "' is not (compiler limitation)");
    }
    bindingPattern = true;
View Full Code Here

      boolean validKey = false;
      for (int i = 0; i < ms.length; i++) {
        ResolvedMember resolvedMember = ms[i];
        if (resolvedMember.getName().equals(k) && resolvedMember.isAbstract()) {
          validKey = true;
          ResolvedType t = resolvedMember.getReturnType().resolve(scope.getWorld());
          if (t.isEnum()) {
            // value must be an enum reference X.Y
            int pos = v.lastIndexOf(".");
            if (pos == -1) {
              IMessage m = MessageUtil.error(WeaverMessages
                  .format(WeaverMessages.INVALID_ANNOTATION_VALUE, v, "enum"), getSourceLocation());
              scope.getWorld().getMessageHandler().handleMessage(m);
            } else {
              String typename = v.substring(0, pos);
              ResolvedType rt = scope.lookupType(typename, this).resolve(scope.getWorld());
              v = rt.getSignature() + v.substring(pos + 1); // from 'Color.RED' to 'Lp/Color;RED'
              annotationValues.put(k, v);
            }
          } else if (t.isPrimitiveType()) {
            if (t.getSignature() == "I") {
              try {
View Full Code Here

      // attempt resolution - this helps with the Spring bug where they resolve() the pointcut in no scope (SPR-5307)
      if (typePattern instanceof WildTypePattern && (annotationValues == null || annotationValues.isEmpty())) {
        WildTypePattern wildTypePattern = (WildTypePattern) typePattern;
        String fullyQualifiedName = wildTypePattern.maybeGetCleanName();
        if (fullyQualifiedName != null && fullyQualifiedName.indexOf(".") != -1) {
          ResolvedType resolvedType = world.resolve(UnresolvedType.forName(fullyQualifiedName));
          if (resolvedType != null && !resolvedType.isMissing()) {
            typePattern = new ExactTypePattern(resolvedType, false, false);
          }
        }
      }
      resolved = true;
View Full Code Here

        IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.REFERENCE_TO_NON_ANNOTATION_TYPE, et
            .getExactType().getName()), getSourceLocation());
        scope.getWorld().getMessageHandler().handleMessage(m);
        resolved = false;
      }
      ResolvedType annotationType = et.getExactType().resolve(scope.getWorld());
      resolveAnnotationValues(annotationType, scope);
      ExactAnnotationTypePattern eatp = new ExactAnnotationTypePattern(annotationType, annotationValues);
      eatp.copyLocationFrom(this);
      if (isForParameterAnnotationMatch()) {
        eatp.setForParameterAnnotationMatch();
View Full Code Here

    // check the interfaces
    if (!needAttribute) {
      if (myType != null) {
        ResolvedType[] interfaceRTXs = myType.getDeclaredInterfaces();
        for (int i = 0; i < interfaceRTXs.length; i++) {
          ResolvedType typeX = interfaceRTXs[i];
          if (typeX.isGenericType() || typeX.isParameterizedType()) {
            needAttribute = true;
          }
        }
        if (extraSuperInterfaces != null) {
          for (int i = 0; i < extraSuperInterfaces.length; i++) {
            ResolvedType interfaceType = extraSuperInterfaces[i];
            if (interfaceType.isGenericType() || interfaceType.isParameterizedType()) {
              needAttribute = true;
            }
          }
        }
      }

      if (myType == null) {
        ResolvedType superclassRTX = superclass;
        if (superclassRTX != null) {
          if (superclassRTX.isGenericType() || superclassRTX.isParameterizedType()) {
            needAttribute = true;
          }
        }
      } else {
        // check the supertype
        ResolvedType superclassRTX = getSuperClass();
        if (superclassRTX.isGenericType() || superclassRTX.isParameterizedType()) {
          needAttribute = true;
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.ResolvedType

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.