public List<LightweightTypeReference> getUpperBounds() { return expose(upperBounds); }
@Override protected List<LightweightTypeReference> getSuperTypes(TypeParameterSubstitutor<?> substitutor) { if (isUnbounded()) { return Collections.singletonList(getUpperBoundSubstitute()); } List<LightweightTypeReference> nonNullUpperBounds = expose(getUpperBounds()); List<LightweightTypeReference> result = Lists.newArrayListWithCapacity(nonNullUpperBounds.size()); for(LightweightTypeReference upperBound: nonNullUpperBounds) { result.add(substitutor.substitute(upperBound)); } return result; }
@Override public boolean isOwnedBy(ITypeReferenceOwner owner) { if (super.isOwnedBy(owner)) { if (lowerBound != null && !lowerBound.isOwnedBy(owner)) return false; for(LightweightTypeReference parameterType: expose(upperBounds)) { if (!parameterType.isOwnedBy(owner)) { return false; } } return true; } return false; }
@Override /* @Nullable */ public LightweightTypeReference getSuperType(Class<?> rawType) { if (isUnbounded()) { if (Object.class.equals(rawType)) { return internalFindTopLevelType(rawType); } return null; } List<LightweightTypeReference> nonNullUpperBounds = expose(getUpperBounds()); for(LightweightTypeReference upperBound: nonNullUpperBounds) { LightweightTypeReference result = upperBound.getSuperType(rawType); if (result != null) return result; } return null; }
@Override /* @Nullable */ public LightweightTypeReference getSuperType(JvmType rawType) { if (isUnbounded()) { if (Object.class.getName().equals(rawType.getIdentifier())) { return getOwner().newParameterizedTypeReference(rawType); } return null; } List<LightweightTypeReference> nonNullUpperBounds = expose(getUpperBounds()); for(LightweightTypeReference upperBound: nonNullUpperBounds) { LightweightTypeReference result = upperBound.getSuperType(rawType); if (result != null) return result; } return null; }