If all supertypes are errors, do not leave the supertype list empty

This commit is contained in:
Andrey Breslav
2013-11-07 18:49:17 +04:00
parent 6915773150
commit b16b9c58e1
@@ -146,7 +146,7 @@ class LazyJavaClassDescriptor(
else { else {
val jlObject = innerC.javaClassResolver.resolveClassByFqName(JavaSupertypeResolver.OBJECT_FQ_NAME)?.getDefaultType() val jlObject = innerC.javaClassResolver.resolveClassByFqName(JavaSupertypeResolver.OBJECT_FQ_NAME)?.getDefaultType()
// If java.lang.Object is not found, we simply use Any to recover // If java.lang.Object is not found, we simply use Any to recover
emptyOrSingletonList(jlObject ?: KotlinBuiltIns.getInstance().getAnyType()) listOf(jlObject ?: KotlinBuiltIns.getInstance().getAnyType())
} }
else else
supertypes.iterator() supertypes.iterator()
@@ -156,6 +156,9 @@ class LazyJavaClassDescriptor(
} }
.filter { supertype -> !supertype.isError() } .filter { supertype -> !supertype.isError() }
.toList() .toList()
.ifEmpty {
listOf(KotlinBuiltIns.getInstance().getAnyType())
}
} }
override fun getSupertypes(): Collection<JetType> = _supertypes() override fun getSupertypes(): Collection<JetType> = _supertypes()