Package org.aspectj.weaver

Examples of org.aspectj.weaver.BoundedReferenceType


      if (isExtends) {
        bound = fromType(upperBounds[0]);
      } else {
        bound = fromType(lowerBounds[0]);
      }
      return new BoundedReferenceType((ReferenceType) bound, isExtends, getWorld());
    } else if (aType instanceof GenericArrayType) {
      GenericArrayType gt = (GenericArrayType) aType;
      Type componentType = gt.getGenericComponentType();
      return UnresolvedType.makeArray(fromType(componentType), 1).resolve(getWorld());
    }
View Full Code Here


        WildcardBinding wb = lookupEnvironment.createWildcard(baseTypeForParameterizedType,
            indexOfTypeParameterBeingConverted, bound, otherBounds, boundkind);
        return wb;
      } else if (typeX instanceof BoundedReferenceType) {
        // translate from boundedreferencetype to WildcardBinding
        BoundedReferenceType brt = (BoundedReferenceType) typeX;
        // Work out 'kind' for the WildcardBinding
        int boundkind = Wildcard.UNBOUND;
        TypeBinding bound = null;
        if (brt.isExtends()) {
          boundkind = Wildcard.EXTENDS;
          bound = makeTypeBinding(brt.getUpperBound());
        } else if (brt.isSuper()) {
          boundkind = Wildcard.SUPER;
          bound = makeTypeBinding(brt.getLowerBound());
        }
        TypeBinding[] otherBounds = null;
        if (brt.getAdditionalBounds() != null && brt.getAdditionalBounds().length != 0) {
          otherBounds = makeTypeBindings(brt.getAdditionalBounds());
        }
        WildcardBinding wb = lookupEnvironment.createWildcard(baseTypeForParameterizedType,
            indexOfTypeParameterBeingConverted, bound, otherBounds, boundkind);
        return wb;
      } else {
View Full Code Here

      if (upperBound != null) {
        if (upperBound.isIncludeSubtypes()) {
          canBeExact = false;
        } else {
          ReferenceType upper = (ReferenceType) upperBound.getExactType().resolve(scope.getWorld());
          type = new BoundedReferenceType(upper, true, scope.getWorld());
        }
      } else {
        if (lowerBound.isIncludeSubtypes()) {
          canBeExact = false;
        } else {
          ReferenceType lower = (ReferenceType) lowerBound.getExactType().resolve(scope.getWorld());
          type = new BoundedReferenceType(lower, false, scope.getWorld());
        }
      }
      if (canBeExact) {
        // might have changed if we find out include subtypes is set on one of the bounds...
        return new ExactTypePattern(type, includeSubtypes, isVarArgs);
View Full Code Here

  // it is a ? extends or ? super deal then we have to match them too.
  private boolean matchesBounds(ResolvedType aType, MatchKind staticOrDynamic) {
    if (!(aType instanceof BoundedReferenceType)) {
      return true;
    }
    BoundedReferenceType boundedRT = (BoundedReferenceType) aType;
    if (upperBound == null && boundedRT.getUpperBound() != null) {
      // for upper bound, null can also match against Object - but anything else and we're out.
      if (!boundedRT.getUpperBound().getName().equals(UnresolvedType.OBJECT.getName())) {
        return false;
      }
    }
    if (lowerBound == null && boundedRT.getLowerBound() != null) {
      return false;
    }
    if (upperBound != null) {
      // match ? extends
      if (aType.isGenericWildcard() && boundedRT.isSuper()) {
        return false;
      }
      if (boundedRT.getUpperBound() == null) {
        return false;
      }
      return upperBound.matches((ResolvedType) boundedRT.getUpperBound(), staticOrDynamic).alwaysTrue();
    }
    if (lowerBound != null) {
      // match ? super
      if (!(boundedRT.isGenericWildcard() && boundedRT.isSuper())) {
        return false;
      }
      return lowerBound.matches((ResolvedType) boundedRT.getLowerBound(), staticOrDynamic).alwaysTrue();
    }
    return true;
  }
View Full Code Here

      if (resolvedBound.isMissing()) {
        world.getLint().cantFindType.signal("Unable to find type (for bound): " + resolvedBound.getName(), null);
        resolvedBound = world.resolve(UnresolvedType.OBJECT);
      }
      ReferenceType rBound = (ReferenceType) resolvedBound;
      return new BoundedReferenceType(rBound, false, world);
    } else if (aTypeArgument.isPlus) {
      UnresolvedType bound = fieldTypeSignature2TypeX(aTypeArgument.signature, typeParams, world,
          inProgressTypeVariableResolutions);
      ResolvedType resolvedBound = world.resolve(bound);
      if (resolvedBound.isMissing()) {
        world.getLint().cantFindType.signal("Unable to find type (for bound): " + resolvedBound.getName(), null);
        resolvedBound = world.resolve(UnresolvedType.OBJECT);
      }
      ReferenceType rBound = (ReferenceType) resolvedBound;
      return new BoundedReferenceType(rBound, true, world);
    } else {
      return fieldTypeSignature2TypeX(aTypeArgument.signature, typeParams, world, inProgressTypeVariableResolutions);
    }
  }
View Full Code Here

      if (isExtends) {
        bound = fromType(upperBounds[0]);
      } else {
        bound = fromType(lowerBounds[0]);
      }
      return new BoundedReferenceType((ReferenceType) bound, isExtends, getWorld());
    } else if (aType instanceof GenericArrayType) {
      GenericArrayType gt = (GenericArrayType) aType;
      Type componentType = gt.getGenericComponentType();
      return UnresolvedType.makeArray(fromType(componentType), 1).resolve(getWorld());
    }
View Full Code Here

      return UnresolvedType.SOMETHING.resolve(world);
    if (aTypeArgument.isMinus) {
      UnresolvedType bound = fieldTypeSignature2TypeX(aTypeArgument.signature, typeParams, world,
          inProgressTypeVariableResolutions);
      ReferenceType rBound = (ReferenceType) world.resolve(bound);
      return new BoundedReferenceType(rBound, false, world);
    } else if (aTypeArgument.isPlus) {
      UnresolvedType bound = fieldTypeSignature2TypeX(aTypeArgument.signature, typeParams, world,
          inProgressTypeVariableResolutions);
      ReferenceType rBound = (ReferenceType) world.resolve(bound);
      return new BoundedReferenceType(rBound, true, world);
    } else {
      return fieldTypeSignature2TypeX(aTypeArgument.signature, typeParams, world, inProgressTypeVariableResolutions);
    }
  }
View Full Code Here

      if (isExtends) {
        bound = fromType(upperBounds[0]);
      } else {
        bound = fromType(lowerBounds[0]);
      }
      return new BoundedReferenceType((ReferenceType)bound,isExtends,getWorld());
    } else if (aType instanceof GenericArrayType) {
      GenericArrayType gt = (GenericArrayType) aType;
      Type componentType = gt.getGenericComponentType();
      return UnresolvedType.makeArray(fromType(componentType),1).resolve(getWorld());
    }
View Full Code Here

  {
    if (aTypeArgument.isWildcard) return UnresolvedType.SOMETHING.resolve(world);
    if (aTypeArgument.isMinus) {
      UnresolvedType bound = fieldTypeSignature2TypeX(aTypeArgument.signature, typeParams,world,inProgressTypeVariableResolutions);
      ReferenceType rBound = (ReferenceType) world.resolve(bound);
      return new BoundedReferenceType(rBound,false,world);
    } else if (aTypeArgument.isPlus) {
      UnresolvedType bound = fieldTypeSignature2TypeX(aTypeArgument.signature, typeParams,world,inProgressTypeVariableResolutions);
      ReferenceType rBound = (ReferenceType) world.resolve(bound);
      return new BoundedReferenceType(rBound,true,world);
    } else {
      return fieldTypeSignature2TypeX(aTypeArgument.signature,typeParams,world,inProgressTypeVariableResolutions);
    }
  }
View Full Code Here

      if (upperBound != null) {
        if (upperBound.isIncludeSubtypes()) {
          canBeExact = false;
        } else {
          ReferenceType upper = (ReferenceType) upperBound.getExactType().resolve(scope.getWorld());
          type = new BoundedReferenceType(upper,true,scope.getWorld());
        }
      } else {
        if (lowerBound.isIncludeSubtypes()) {
          canBeExact = false;
        } else {
          ReferenceType lower = (ReferenceType) lowerBound.getExactType().resolve(scope.getWorld());
          type = new BoundedReferenceType(lower,false,scope.getWorld());
        }
      }
      if (canBeExact) {
        // might have changed if we find out include subtypes is set on one of the bounds...
        return new ExactTypePattern(type,includeSubtypes,isVarArgs);
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.BoundedReferenceType

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.