/** * resolve the type variable we are managing and then return this object. 'this' is already a ResolvedType but the type variable * may transition from a not-resolved to a resolved state. */ public ResolvedType resolve(World world) { typeVariable.resolve(world); return this; }
public ReferenceType getUpperBound() { return (ReferenceType) typeVariable.resolve(world).getUpperBound(); }
@Override public TypeVariable[] getTypeVariables() { if (typeVariables == null) { typeVariables = getDelegate().getTypeVariables(); for (int i = 0; i < this.typeVariables.length; i++) { typeVariables[i].resolve(world); } } return typeVariables; }
public TypeVariable[] getTypeVariables() { if (this.typeVariables == null && componentType.getTypeVariables() != null) { this.typeVariables = componentType.getTypeVariables(); for (int i = 0; i < this.typeVariables.length; i++) { this.typeVariables[i].resolve(world); } } return this.typeVariables; }
@Override public ResolvedType resolve(World world) { TypeVariableDeclaringElement typeVariableScope = world.getTypeVariableLookupScope(); TypeVariable resolvedTypeVariable = null; TypeVariableReferenceType tvrt = null; if (typeVariableScope == null) { // throw new BCException("There is no scope in which to lookup type variables!"); // FIXME asc correct thing to do is go bang, but to limp along, lets cope with the scope missing resolvedTypeVariable = typeVariable.resolve(world); tvrt = new TypeVariableReferenceType(resolvedTypeVariable, world); } else { boolean foundOK = false; resolvedTypeVariable = typeVariableScope.getTypeVariableNamed(typeVariable.getName()); // FIXME asc remove this when the shared type var stuff is sorted if (resolvedTypeVariable == null) { resolvedTypeVariable = typeVariable.resolve(world); } else { foundOK = true; } tvrt = new TypeVariableReferenceType(resolvedTypeVariable, world); } return tvrt; }
@Override public boolean isAnnotation() { ReferenceType upper = (ReferenceType) typeVariable.getUpperBound(); if (upper.isAnnotation()) { return true; } World world = upper.getWorld(); typeVariable.resolve(world); ResolvedType annotationType = ResolvedType.ANNOTATION.resolve(world); UnresolvedType[] ifBounds = typeVariable.getSuperInterfaces();// AdditionalBounds(); for (int i = 0; i < ifBounds.length; i++) { if (((ReferenceType) ifBounds[i]).isAnnotation()) { return true; } if (ifBounds[i].equals(annotationType)) { return true; // annotation itself does not have the annotation flag set in Java! } } return false; }
if (typeVariables != null && typeVariables.length > 0) { for (int i = 0; i < typeVariables.length; i++) { typeVariables[i] = typeVariables[i].resolve(world);
TypeVariableReferenceType tvrt = (TypeVariableReferenceType) myTypeParameters[i]; TypeVariable tv = tvrt.getTypeVariable(); tv.resolve(world); if (!tv.canBeBoundTo(theirTypeParameters[i])) { return false; TypeVariableReferenceType tvrt = (TypeVariableReferenceType) theirTypeParameters[i]; TypeVariable tv = tvrt.getTypeVariable(); tv.resolve(world); if (!tv.canBeBoundTo(myTypeParameters[i])) { return false;