Package org.aspectj.weaver

Examples of org.aspectj.weaver.TypeVariable


    if (this.typeVariables == null) {
      java.lang.reflect.TypeVariable[] tVars = this.getBaseClass().getTypeParameters();
      TypeVariable[] rTypeVariables = new TypeVariable[tVars.length];
      // basic initialization
      for (int i = 0; i < tVars.length; i++) {
        rTypeVariables[i] = new TypeVariable(tVars[i].getName());
      }
      // stash it
      this.getResolvedTypeX().getWorld().recordTypeVariablesCurrentlyBeingProcessed(getBaseClass(), rTypeVariables);
      // now fill in the details...
      for (int i = 0; i < tVars.length; i++) {
        TypeVariableReferenceType tvrt = ((TypeVariableReferenceType) typeConverter.fromType(tVars[i]));
        TypeVariable tv = tvrt.getTypeVariable();
        rTypeVariables[i].setSuperclass(tv.getSuperclass());
        rTypeVariables[i].setAdditionalInterfaceBounds(tv.getSuperInterfaces());
        rTypeVariables[i].setDeclaringElement(tv.getDeclaringElement());
        rTypeVariables[i].setDeclaringElementKind(tv.getDeclaringElementKind());
        rTypeVariables[i].setRank(tv.getRank());
      }
      this.typeVariables = rTypeVariables;
      this.getResolvedTypeX().getWorld().forgetTypeVariablesCurrentlyBeingProcessed(getBaseClass());
    }
    return this.typeVariables;
View Full Code Here


      if (typeVariablesInProgress.get(aType) != null) {
        return typeVariablesInProgress.get(aType);
      }

      java.lang.reflect.TypeVariable tv = (java.lang.reflect.TypeVariable) aType;
      TypeVariable rt_tv = new TypeVariable(tv.getName());
      TypeVariableReferenceType tvrt = new TypeVariableReferenceType(rt_tv, getWorld());

      typeVariablesInProgress.put(aType, tvrt); // record what we are working on, for recursion case

      Type[] bounds = tv.getBounds();
      ResolvedType[] resBounds = fromTypes(bounds);
      ResolvedType upperBound = resBounds[0];
      ResolvedType[] additionalBounds = new ResolvedType[0];
      if (resBounds.length > 1) {
        additionalBounds = new ResolvedType[resBounds.length - 1];
        System.arraycopy(resBounds, 1, additionalBounds, 0, additionalBounds.length);
      }
      rt_tv.setUpperBound(upperBound);
      rt_tv.setAdditionalInterfaceBounds(additionalBounds);

      typeVariablesInProgress.remove(aType); // we have finished working on it

      return tvrt;
    } else if (aType instanceof WildcardType) {
View Full Code Here

      for (int i = 0; i < superInterfaceBindings.length; i++) {
        superinterfaces[i] = UnresolvedType.forSignature(new String(superInterfaceBindings[i].signature()));
      }
    }
    // XXX what about lower binding?
    TypeVariable tv = new TypeVariable(name, superclass, superinterfaces);
    tv.setDeclaringElement(factory.fromBinding(typeParameter.binding.declaringElement));
    tv.setRank(typeParameter.binding.rank);
    return tv;
  }
View Full Code Here

      if (myType != null) {
        TypeVariable[] tVars = myType.getTypeVariables();
        if (tVars.length > 0) {
          signature.append("<");
          for (int i = 0; i < tVars.length; i++) {
            TypeVariable variable = tVars[i];
            signature.append(variable.getSignatureForAttribute());
          }
          signature.append(">");
        }
      }
      // now the supertype
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 = null;
    if (aTypeVariableBinding == null || aTypeVariableBinding.superInterfaces == null) {
      // sign of another bug that will be reported elsewhere
      superinterfaces = UnresolvedType.NONE;
    } else {
      superinterfaces = new UnresolvedType[aTypeVariableBinding.superInterfaces.length];
      for (int i = 0; i < superinterfaces.length; i++) {
        superinterfaces[i] = fromBinding(aTypeVariableBinding.superInterfaces[i]);
      }
    }
    tv.setSuperclass(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);
    }
View Full Code Here

      if (myType != null) {
        TypeVariable[] tVars = myType.getTypeVariables();
        if (tVars.length > 0) {
          signature.append("<");
          for (int i = 0; i < tVars.length; i++) {
            TypeVariable variable = tVars[i];
            signature.append(variable.getSignatureForAttribute());
          }
          signature.append(">");
        }
      }
      // now the supertype
View Full Code Here

            canCreateExactTypePattern = false;
          }
        }
      }
      if (canCreateExactTypePattern) {
        TypeVariable tv = tvrType.getTypeVariable();
        if (upperBound != null) {
          tv.setSuperclass(upperBound.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);
        }
View Full Code Here

    UnresolvedType[] ifBounds = new UnresolvedType[aFormalTypeParameter.interfaceBounds.length];
    for (int i = 0; i < ifBounds.length; i++) {
      ifBounds[i] = fieldTypeSignature2TypeX(aFormalTypeParameter.interfaceBounds[i], typeParams, world,
          inProgressTypeVariableResolutions);
    }
    return new TypeVariable(aFormalTypeParameter.identifier, upperBound, ifBounds);
  }
View Full Code Here

    }
    if (typeVarBounds == null) {
      // blowing up here breaks the situation with ITDs where the type variable is mentioned in the
      // declaring type and used somewhere in the signature. Temporary change to allow it to return just a
      // 'dumb' typevariablereference.
      return new TypeVariableReferenceType(new TypeVariable(aTypeVarSig.typeVariableName), world);
      // throw new GenericSignatureFormatException("Undeclared type variable in signature: " + aTypeVarSig.typeVariableName);
    }
    if (inProgressTypeVariableResolutions.containsKey(typeVarBounds)) {
      return inProgressTypeVariableResolutions.get(typeVarBounds);
    }
View Full Code Here

      if (inprogressVar != null) {
        return inprogressVar;
      }

      java.lang.reflect.TypeVariable tv = (java.lang.reflect.TypeVariable) aType;
      TypeVariable rt_tv = new TypeVariable(tv.getName());
      TypeVariableReferenceType tvrt = new TypeVariableReferenceType(rt_tv, getWorld());

      typeVariablesInProgress.put(aType, tvrt); // record what we are working on, for recursion case

      Type[] bounds = tv.getBounds();
      ResolvedType[] resBounds = fromTypes(bounds);
      ResolvedType upperBound = resBounds[0];
      ResolvedType[] additionalBounds = new ResolvedType[0];
      if (resBounds.length > 1) {
        additionalBounds = new ResolvedType[resBounds.length - 1];
        System.arraycopy(resBounds, 1, additionalBounds, 0, additionalBounds.length);
      }
      rt_tv.setUpperBound(upperBound);
      rt_tv.setAdditionalInterfaceBounds(additionalBounds);

      typeVariablesInProgress.remove(aType); // we have finished working on it

      return tvrt;
    } else if (aType instanceof WildcardType) {
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.