Fix TypeConstructor#getSupertypes() return type
This commit is contained in:
+2
-1
@@ -60,7 +60,8 @@ public final class DescriptorResolverUtils {
|
||||
return kind == ClassKind.CLASS || kind == ClassKind.TRAIT || kind == ClassKind.ENUM_CLASS;
|
||||
}
|
||||
|
||||
public static Collection<? extends JetType> getSupertypes(@NotNull ClassOrNamespaceDescriptor classOrNamespaceDescriptor) {
|
||||
@NotNull
|
||||
public static Collection<JetType> getSupertypes(@NotNull ClassOrNamespaceDescriptor classOrNamespaceDescriptor) {
|
||||
if (classOrNamespaceDescriptor instanceof ClassDescriptor) {
|
||||
return ((ClassDescriptor) classOrNamespaceDescriptor).getTypeConstructor().getSupertypes();
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ public class DescriptorUtils {
|
||||
|
||||
@NotNull
|
||||
public static List<ClassDescriptor> getSuperclassDescriptors(@NotNull ClassDescriptor classDescriptor) {
|
||||
Collection<? extends JetType> superclassTypes = classDescriptor.getTypeConstructor().getSupertypes();
|
||||
Collection<JetType> superclassTypes = classDescriptor.getTypeConstructor().getSupertypes();
|
||||
List<ClassDescriptor> superClassDescriptors = new ArrayList<ClassDescriptor>();
|
||||
for (JetType type : superclassTypes) {
|
||||
ClassDescriptor result = getClassDescriptorForType(type);
|
||||
|
||||
@@ -346,7 +346,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<? extends JetType> getSupertypes() {
|
||||
public Collection<JetType> getSupertypes() {
|
||||
if (supertypes == null) {
|
||||
if (resolveSession.isClassSpecial(DescriptorUtils.getFQName(LazyClassDescriptor.this))) {
|
||||
this.supertypes = Collections.emptyList();
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ public class LazyTypeParameterDescriptor implements TypeParameterDescriptor, Laz
|
||||
typeConstructor = new TypeConstructor() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<? extends JetType> getSupertypes() {
|
||||
public Collection<JetType> getSupertypes() {
|
||||
return LazyTypeParameterDescriptor.this.getUpperBounds();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class IntersectionTypeConstructor extends AnnotatedImpl implements TypeCo
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<? extends JetType> getSupertypes() {
|
||||
public Collection<JetType> getSupertypes() {
|
||||
return intersectedTypes;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public interface TypeConstructor extends Annotated {
|
||||
List<TypeParameterDescriptor> getParameters();
|
||||
|
||||
@NotNull
|
||||
Collection<? extends JetType> getSupertypes();
|
||||
Collection<JetType> getSupertypes();
|
||||
|
||||
boolean isSealed();
|
||||
|
||||
|
||||
+1
-1
@@ -445,7 +445,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
) {
|
||||
JetType result = null;
|
||||
JetType thisType = thisReceiver.getType();
|
||||
Collection<? extends JetType> supertypes = thisType.getConstructor().getSupertypes();
|
||||
Collection<JetType> supertypes = thisType.getConstructor().getSupertypes();
|
||||
TypeSubstitutor substitutor = TypeSubstitutor.create(thisType);
|
||||
|
||||
JetTypeReference superTypeQualifier = expression.getSuperTypeQualifier();
|
||||
|
||||
@@ -611,12 +611,12 @@ public class DescriptorRenderer implements Renderer<DeclarationDescriptor> {
|
||||
renderTypeParameters(descriptor.getTypeConstructor().getParameters(), builder);
|
||||
}
|
||||
if (!descriptor.equals(KotlinBuiltIns.getInstance().getNothing())) {
|
||||
Collection<? extends JetType> supertypes = descriptor.getTypeConstructor().getSupertypes();
|
||||
Collection<JetType> supertypes = descriptor.getTypeConstructor().getSupertypes();
|
||||
if (supertypes.isEmpty() || supertypes.size() == 1 && KotlinBuiltIns.getInstance().isAny(supertypes.iterator().next())) {
|
||||
}
|
||||
else {
|
||||
builder.append(" : ");
|
||||
for (Iterator<? extends JetType> iterator = supertypes.iterator(); iterator.hasNext(); ) {
|
||||
for (Iterator<JetType> iterator = supertypes.iterator(); iterator.hasNext(); ) {
|
||||
JetType supertype = iterator.next();
|
||||
builder.append(renderType(supertype));
|
||||
if (iterator.hasNext()) {
|
||||
|
||||
@@ -67,7 +67,7 @@ public class GotoSuperActionHandler implements CodeInsightActionHandler {
|
||||
Collection<? extends DeclarationDescriptor> superDescriptors;
|
||||
String message;
|
||||
if (descriptor instanceof ClassDescriptor) {
|
||||
Collection<? extends JetType> supertypes = ((ClassDescriptor) descriptor).getTypeConstructor().getSupertypes();
|
||||
Collection<JetType> supertypes = ((ClassDescriptor) descriptor).getTypeConstructor().getSupertypes();
|
||||
List<ClassDescriptor> superclasses = ContainerUtil.mapNotNull(supertypes, new Function<JetType, ClassDescriptor>() {
|
||||
@Override
|
||||
public ClassDescriptor fun(JetType type) {
|
||||
|
||||
@@ -182,7 +182,7 @@ public final class ClassTranslator extends AbstractTranslator {
|
||||
|
||||
@NotNull
|
||||
private List<JsExpression> getSupertypesNameReferences() {
|
||||
Collection<? extends JetType> supertypes = descriptor.getTypeConstructor().getSupertypes();
|
||||
Collection<JetType> supertypes = descriptor.getTypeConstructor().getSupertypes();
|
||||
if (supertypes.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user