dec instanceof IntersectionType;
boolean canCache = !complexType &&
!hasUnderlyingType() &&
collectVarianceOverrides().isEmpty() &&
ProducedTypeCache.isEnabled();
ProducedTypeCache cache = dec.getUnit().getCache();
if (canCache &&
cache.containsKey(this, dec)) {
return cache.get(this, dec);
}
SupertypeCheck check =
checkSupertype(getDeclaration(), dec);
ProducedType superType;
if (check == SupertypeCheck.NO) {
superType = null;
}
else if (check == SupertypeCheck.YES &&
dec instanceof ClassOrInterface &&
dec.isToplevel() &&
dec.getTypeParameters().isEmpty()) {
superType = dec.getType();
}
else if (check == SupertypeCheck.YES &&
dec == getDeclaration() &&
dec.isToplevel()) {
superType = this;
}
else {
superType = getSupertype(new SupertypeCriteria(dec));
}
if (canCache) {
cache.put(this, dec, superType);
}
return superType;
}