Package org.aspectj.weaver

Examples of org.aspectj.weaver.TypeVariable


        for (int i = 0; i < additionalInterfaceBounds.length; i++) {
          if (ResolvedType.isMissing(additionalInterfaceBounds[i].getExactType())) canCreateExactTypePattern = false;
        }
      }
      if (canCreateExactTypePattern) {
        TypeVariable tv = tvrType.getTypeVariable();
        if (upperBound != null) tv.setUpperBound(upperBound.getExactType());
        if (lowerBound != null) tv.setLowerBound(lowerBound.getExactType());
        if (additionalInterfaceBounds != null) {
          UnresolvedType[] ifBounds = new UnresolvedType[additionalInterfaceBounds.length];
          for (int i = 0; i < ifBounds.length; i++) {
            ifBounds[i] = additionalInterfaceBounds[i].getExactType();
          }
          tv.setAdditionalInterfaceBounds(ifBounds);
        }
        ResolvedType rType = tvrType.resolve(scope.getWorld());
        if (dim != 0) rType = ResolvedType.makeArray(rType, dim);
        return new ExactTypePattern(rType,includeSubtypes,isVarArgs);               
      }
View Full Code Here


    // Check if its a type variable binding that we need to recover to an alias...
    if (typeVariablesForAliasRecovery!=null) {
      String aliasname = (String)typeVariablesForAliasRecovery.get(aTypeVariableBinding);
      if (aliasname!=null) {
        UnresolvedTypeVariableReferenceType ret = new UnresolvedTypeVariableReferenceType();
        ret.setTypeVariable(new TypeVariable(aliasname));
        return ret;
      }
    }
   
    if (typeVariablesForThisMember.containsKey(new String(aTypeVariableBinding.sourceName))) {
      return (UnresolvedType)typeVariablesForThisMember.get(new String(aTypeVariableBinding.sourceName));
    }
   
   
    // Create the UnresolvedTypeVariableReferenceType for the type variable
    String name = CharOperation.charToString(aTypeVariableBinding.sourceName());
   
    UnresolvedTypeVariableReferenceType ret = new UnresolvedTypeVariableReferenceType();
    typeVariableBindingsInProgress.put(aTypeVariableBinding,ret);
   
    TypeVariable tv = new TypeVariable(name);
    ret.setTypeVariable(tv);
    // Dont set any bounds here, you'll get in a recursive mess
    // TODO -- what about lower bounds??
    UnresolvedType superclassType    = fromBinding(aTypeVariableBinding.superclass());
    UnresolvedType[] superinterfaces = new UnresolvedType[aTypeVariableBinding.superInterfaces.length];
    for (int i = 0; i < superinterfaces.length; i++) {
      superinterfaces[i] = fromBinding(aTypeVariableBinding.superInterfaces[i]);
    }
    tv.setUpperBound(superclassType);
    tv.setAdditionalInterfaceBounds(superinterfaces);
    tv.setRank(aTypeVariableBinding.rank);
    if (aTypeVariableBinding.declaringElement instanceof MethodBinding) {
      tv.setDeclaringElementKind(TypeVariable.METHOD);
//      tv.setDeclaringElement(fromBinding((MethodBinding)aTypeVariableBinding.declaringElement);
    } else {
      tv.setDeclaringElementKind(TypeVariable.TYPE);
//        //  tv.setDeclaringElement(fromBinding(aTypeVariableBinding.declaringElement));
    }
    if (aTypeVariableBinding.declaringElement instanceof MethodBinding)
      typeVariablesForThisMember.put(new String(aTypeVariableBinding.sourceName),ret);
    typeVariableBindingsInProgress.remove(aTypeVariableBinding);
View Full Code Here

   * Converts from an TypeVariableReference to a TypeVariableBinding.  A TypeVariableReference
   * in AspectJ world holds a TypeVariable and it is this type variable that is converted
   * to the TypeVariableBinding.
   */
  private TypeVariableBinding makeTypeVariableBinding(TypeVariableReference tvReference) {
    TypeVariable tv = tvReference.getTypeVariable();
    TypeVariableBinding tvBinding = (TypeVariableBinding)typeVariableToTypeBinding.get(tv.getName());
    if (currentType!=null) {
      TypeVariableBinding tvb = currentType.getTypeVariable(tv.getName().toCharArray());     
      if (tvb!=null) return tvb;
    }
    if (tvBinding==null) {
      Binding declaringElement = null;
      // this will cause an infinite loop or NPE... not required yet luckily.
//      if (tVar.getDeclaringElement() instanceof Member) {
//      declaringElement = makeMethodBinding((ResolvedMember)tVar.getDeclaringElement());
//      } else {
//      declaringElement = makeTypeBinding((UnresolvedType)tVar.getDeclaringElement());
//      }
      tvBinding = new TypeVariableBinding(tv.getName().toCharArray(),declaringElement,tv.getRank());
      typeVariableToTypeBinding.put(tv.getName(),tvBinding);
      tvBinding.superclass=(ReferenceBinding)makeTypeBinding(tv.getUpperBound());
      tvBinding.firstBound=(ReferenceBinding)makeTypeBinding(tv.getFirstBound());
      if (tv.getAdditionalInterfaceBounds()==null) {
      tvBinding.superInterfaces=TypeVariableBinding.NoSuperInterfaces;
      } else {
      TypeBinding tbs[] = makeTypeBindings(tv.getAdditionalInterfaceBounds());
      ReferenceBinding[] rbs= new ReferenceBinding[tbs.length];
      for (int i = 0; i < tbs.length; i++) {
        rbs[i] = (ReferenceBinding)tbs[i];
      }
      tvBinding.superInterfaces=rbs;
View Full Code Here

   */
  public UnresolvedType lookupType(String name, IHasPosition location) {
    for (int i = 0; i < typeVariableNames.length; i++) {
      if (typeVariableNames[i].equals(name)) {
        if (typeVarTypeXs[i] == null) {
          typeVarTypeXs[i] = new UnresolvedTypeVariableReferenceType(new TypeVariable(name));
        }
        return typeVarTypeXs[i];
      }
    }
    return delegateScope.lookupType(name, location);
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.TypeVariable

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.