private boolean matchesTypeVariable(TypeVariableReferenceType matchType) { // was this method previously coded to return false *on purpose* ?? pr124808 return this.type.equals(((TypeVariableReference) matchType).getTypeVariable().getFirstBound()); // return false; }
/** * return a version of this type pattern with all type variables references replaced by the corresponding entry in the map. */ @Override public TypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { UnresolvedType newType = type; if (type.isTypeVariableReference()) { TypeVariableReference t = (TypeVariableReference) type; String key = t.getTypeVariable().getName(); if (typeVariableMap.containsKey(key)) { newType = (UnresolvedType) typeVariableMap.get(key); } } else if (type.isParameterizedType()) { newType = w.resolve(type).parameterize(typeVariableMap); } ExactTypePattern ret = new ExactTypePattern(newType, includeSubtypes, isVarArgs); ret.annotationPattern = annotationPattern.parameterizeWith(typeVariableMap, w); ret.copyLocationFrom(this); return ret; }
@Override public AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { UnresolvedType newAnnotationType = annotationType; if (annotationType.isTypeVariableReference()) { TypeVariableReference t = (TypeVariableReference) annotationType; String key = t.getTypeVariable().getName(); if (typeVariableMap.containsKey(key)) { newAnnotationType = typeVariableMap.get(key); } } else if (annotationType.isParameterizedType()) { newAnnotationType = annotationType.parameterize(typeVariableMap); } ExactAnnotationTypePattern ret = new ExactAnnotationTypePattern(newAnnotationType, annotationValues); ret.formalName = formalName; ret.bindingPattern = bindingPattern; ret.copyLocationFrom(this); if (isForParameterAnnotationMatch()) { ret.setForParameterAnnotationMatch(); } return ret; }
public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) { UnresolvedType newAnnotationType = annotationType; if (annotationType.isTypeVariableReference()) { TypeVariableReference t = (TypeVariableReference) annotationType; String key = t.getTypeVariable().getName(); if (typeVariableMap.containsKey(key)) { newAnnotationType = (UnresolvedType) typeVariableMap.get(key); } } else if (annotationType.isParameterizedType()) { newAnnotationType = annotationType.parameterize(typeVariableMap); } BindingAnnotationTypePattern ret = new BindingAnnotationTypePattern(newAnnotationType, this.formalIndex); if (newAnnotationType instanceof ResolvedType) { ResolvedType rat = (ResolvedType) newAnnotationType; verifyRuntimeRetention(rat.getWorld(), rat); } ret.copyLocationFrom(this); return ret; }
if (tParm.isTypeVariableReference()) { TypeVariableReference tvrt = (TypeVariableReference) tParm; TypeVariable tv = tvrt.getTypeVariable(); int rank = getRank(tv.getName());
protected UnresolvedType parameterize(UnresolvedType aType, Map<String, UnresolvedType> typeVariableMap, boolean inParameterizedType, World w) { if (aType instanceof TypeVariableReference) { String variableName = ((TypeVariableReference) aType).getTypeVariable().getName(); if (!typeVariableMap.containsKey(variableName)) { return aType; // if the type variable comes from the method (and
protected boolean matchesSubtypes(ResolvedType type) { // System.out.println("matching: " + this + " to " + type); if (matchesExactly(type)) { return true; } // pr124808 Iterator<ResolvedType> typesIterator = null; if (type.isTypeVariableReference()) { typesIterator = ((TypeVariableReference) type).getTypeVariable().getFirstBound().resolve(type.getWorld()) .getDirectSupertypes(); } else { // pr223605 if (type.isRawType()) { type = type.getGenericType(); } typesIterator = type.getDirectSupertypes(); } for (Iterator<ResolvedType> i = typesIterator; i.hasNext();) { ResolvedType superType = i.next(); if (matchesSubtypes(superType, type)) { return true; } } return false; }
pMember = ((TypeVariableReference) pMember).getTypeVariable().getFirstBound().resolve(world); pLookingFor = ((TypeVariableReference) pLookingFor).getTypeVariable().getFirstBound() .resolve(world);
b = ((ResolvedType) upperBound).isParameterizedWithTypeVariable(); } else if (upperBound.isTypeVariableReference() && ((TypeVariableReference) upperBound).getTypeVariable().getDeclaringElementKind() == TypeVariable.METHOD) { b = true; b = ((ResolvedType) lowerBound).isParameterizedWithTypeVariable(); } else if (lowerBound.isTypeVariableReference() && ((TypeVariableReference) lowerBound).getTypeVariable().getDeclaringElementKind() == TypeVariable.METHOD) { b = true;
parameterName = ((TypeVariableReference) ut).getTypeVariable().getDisplayName();
searchType = ((TypeVariableReference) searchType).getTypeVariable().getFirstBound().resolve(scope.getWorld()); UnresolvedType One = ((TypeVariableReference) parameterTypes[i]).getTypeVariable().getFirstBound(); UnresolvedType Two = ((TypeVariableReference) p.getExactType()).getTypeVariable().getFirstBound(); reportProblem = !One.resolve(scope.getWorld()).isAssignableFrom(Two.resolve(scope.getWorld())); } else {
.getTypeVariable(); return aVar.resolve(world).canBeBoundTo(other); if (this instanceof TypeVariableReference) { return ((TypeVariableReference) this) .getTypeVariable() .resolve(world) .canBeBoundTo(
String typeVariableName = ((TypeVariableReference) onType).getTypeVariable().getName(); for (int i = 0; i < tvs.length; i++) { if (tvs[i].getName().equals(typeVariableName)) {