public String getErasureSignature() { return getFirstBound().getErasureSignature(); }
@Override public String getErasureSignature() { return typeVariable.getFirstBound().getSignature(); }
public String getDisplayName() { StringBuffer ret = new StringBuffer(); ret.append(name); if (!getFirstBound().getName().equals("java.lang.Object")) { ret.append(" extends "); ret.append(getFirstBound().getName()); if (superInterfaces != null) { for (int i = 0; i < superInterfaces.length; i++) { if (!getFirstBound().equals(superInterfaces[i])) { ret.append(" & "); ret.append(superInterfaces[i].getName()); } } } } return ret.toString(); }
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; }
public void setTypeVariable(TypeVariable aTypeVariable) { this.signature = "T" + aTypeVariable.getName() + ";"; // aTypeVariable.getUpperBound().getSignature(); this.signatureErasure = aTypeVariable.getFirstBound().getErasureSignature(); this.typeVariable = aTypeVariable; this.typeKind = TypeKind.TYPE_VARIABLE; }
public UnresolvedTypeVariableReferenceType(TypeVariable aTypeVariable) { super("T" + aTypeVariable.getName() + ";", aTypeVariable.getFirstBound().getErasureSignature());//aTypeVariable.getFirstBound().getSignature()); this.typeVariable = aTypeVariable; }
public static void appendSigWithTypeVarBoundsRemoved(UnresolvedType aType, StringBuffer toBuffer, Set<UnresolvedType> alreadyUsedTypeVars) { if (aType.isTypeVariableReference()) { TypeVariableReferenceType typeVariableRT = (TypeVariableReferenceType) aType; // pr204505 if (alreadyUsedTypeVars.contains(aType)) { toBuffer.append("..."); } else { alreadyUsedTypeVars.add(aType); appendSigWithTypeVarBoundsRemoved(typeVariableRT.getTypeVariable().getFirstBound(), toBuffer, alreadyUsedTypeVars); } // toBuffer.append("T;"); } else if (aType.isParameterizedType()) { toBuffer.append(aType.getRawType().getSignature()); toBuffer.append("<"); for (int i = 0; i < aType.getTypeParameters().length; i++) { appendSigWithTypeVarBoundsRemoved(aType.getTypeParameters()[i], toBuffer, alreadyUsedTypeVars); } toBuffer.append(">;"); } else { toBuffer.append(aType.getSignature()); } }
private UnresolvedType[] getTypesForMemberParameterization() { UnresolvedType[] parameters = null; if (isParameterizedType()) { parameters = getTypeParameters(); } else if (isRawType()) { // raw type, use upper bounds of type variables on generic type TypeVariable[] tvs = getGenericType().getTypeVariables(); parameters = new UnresolvedType[tvs.length]; for (int i = 0; i < tvs.length; i++) { parameters[i] = tvs[i].getFirstBound(); } } return parameters; }
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; }
firstbound = getFirstBound().resolve(world);
pMember = ((TypeVariableReference) pMember).getTypeVariable().getFirstBound().resolve(world); pLookingFor = ((TypeVariableReference) pLookingFor).getTypeVariable().getFirstBound() .resolve(world);
UnresolvedType ut = (!typeParametersSupplied ? typeVariables[i].getFirstBound() : typeParameters[i]); typeMap.put(typeVariables[i].getName(), ut); int posn = 0; for (String typeVariableAlias : aliases) { typeMap.put(typeVariableAlias, (!typeParametersSupplied ? typeVariables[posn].getFirstBound() : typeParameters[posn])); posn++;
/** * For a TypeVariableReferenceType the delegate is the delegate for the first bound. */ @Override public ReferenceTypeDelegate getDelegate() { if (this.delegate == null) { ResolvedType resolvedFirstBound = typeVariable.getFirstBound().resolve(world); BoundedReferenceTypeDelegate brtd = null; if (resolvedFirstBound.isMissing()) { brtd = new BoundedReferenceTypeDelegate((ReferenceType) world.resolve(UnresolvedType.OBJECT)); setDelegate(brtd); // set now because getSourceLocation() below will cause a recursive step to discover the delegate world.getLint().cantFindType.signal( "Unable to find type for generic bound. Missing type is " + resolvedFirstBound.getName(), getSourceLocation()); } else { brtd = new BoundedReferenceTypeDelegate((ReferenceType) resolvedFirstBound); setDelegate(brtd); } } return this.delegate; }
parameterType = ((UnresolvedTypeVariableReferenceType) parameterType).getTypeVariable().getFirstBound();
UnresolvedType ut = (!typeParametersSupplied ? typeVariables[i].getFirstBound() : typeParameters[i]); typeMap.put(typeVariables[i].getName(), ut);
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 {
@Override public void resolve(IScope scope) { exception = exception.resolveBindings(scope, null, false, true); ResolvedType excType = exception.getExactType().resolve(scope.getWorld()); if (!excType.isMissing()) { if (excType.isTypeVariableReference()) { TypeVariableReferenceType typeVariableRT = (TypeVariableReferenceType) excType; // a declare soft in a generic abstract aspect, we need to check the upper bound // WIBBLE excType = typeVariableRT.getTypeVariable().getFirstBound().resolve(scope.getWorld()); } if (!scope.getWorld().getCoreType(UnresolvedType.THROWABLE).isAssignableFrom(excType)) { scope.getWorld() .showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.NOT_THROWABLE, excType.getName()), exception.getSourceLocation(), null); pointcut = Pointcut.makeMatchesNothing(Pointcut.RESOLVED); return; } // ENH 42743 suggests that we don't soften runtime exceptions. if (scope.getWorld().getCoreType(UnresolvedType.RUNTIME_EXCEPTION).isAssignableFrom(excType)) { scope.getWorld().getLint().runtimeExceptionNotSoftened.signal(new String[] { excType.getName() }, exception .getSourceLocation(), null); pointcut = Pointcut.makeMatchesNothing(Pointcut.RESOLVED); return; } } pointcut = pointcut.resolve(scope); }
.resolve(world) .canBeBoundTo( otherType.getTypeVariable().getFirstBound() .getFirstBound().resolve(world));