public boolean comprisedOfIntersectionType(IntersectionType iType) { for (Iterator it = typeArguments().iterator(); it.hasNext(); ) { Type next = (Type) it.next(); if (next instanceof IntersectionType && ts.equals(next, iType)) return true; if (next instanceof ParameterizedType && ((ParameterizedType) next).comprisedOfIntersectionType(iType)) return true; } return false; }
public String toString() { StringBuffer sb = new StringBuffer(baseType.toString()); sb.append("<"); for (Iterator it = typeArguments().iterator(); it.hasNext(); ) { sb.append(((Type) it.next())); if (it.hasNext()) { sb.append(", "); } } sb.append(">"); return sb.toString(); }
public String signature() { StringBuffer signature = new StringBuffer(); // no trailing ; for base type before the type args signature.append("L" + ((Named) baseType).fullName().replaceAll("\\.", "/") + "<"); for (Iterator it = typeArguments.iterator(); it.hasNext(); ) { SignatureType next = (SignatureType) it.next(); signature.append(next.signature()); if (it.hasNext()) { signature.append(","); } } signature.append(">;"); return signature.toString(); }
public Type convertToInferred(List typeVars, List inferredTypes) { List newBounds = new ArrayList(); for (Iterator it = typeArguments().iterator(); it.hasNext(); ) { Type next = (Type) it.next(); if (next instanceof IntersectionType) { newBounds.add(inferredTypes.get(typeVars.indexOf(next))); } else if (next instanceof ParameterizedType) { newBounds.add(((ParameterizedType) next).convertToInferred(typeVars, inferredTypes)); } /*else if (next instanceof AnySubType){ newBounds.add(((AnySubType)next).convertToInferred(typeVars, inferredTypes)); }*/ else { newBounds.add(next); } } ParameterizedType converted = ((JL5TypeSystem) typeSystem()).parameterizedType(this.baseType()); converted.typeArguments(newBounds); return converted; }