diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java index d8a930e6bcc..023288e6031 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java @@ -490,20 +490,16 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes @Mutable public final Collection trueSupertypes; @Mutable - public final Collection cyclicSupertypes; + public final Collection allSuperTypes; - private Supertypes(@Mutable @NotNull Collection trueSupertypes) { - this(trueSupertypes, new ArrayList(0)); - } - - private Supertypes(@Mutable @NotNull Collection trueSupertypes, @Mutable @NotNull Collection cyclicSupertypes) { - this.trueSupertypes = trueSupertypes; - this.cyclicSupertypes = cyclicSupertypes; + private Supertypes(@Mutable @NotNull Collection allSuperTypes) { + this.trueSupertypes = allSuperTypes; + this.allSuperTypes = new ArrayList(allSuperTypes); } @NotNull public Collection getAllSupertypes() { - return CollectionsKt.plus(trueSupertypes, cyclicSupertypes); + return allSuperTypes; } } @@ -537,7 +533,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes new Function1() { @Override public Unit invoke(@NotNull Supertypes supertypes) { - findAndDisconnectLoopsInTypeHierarchy(supertypes); + findAndDisconnectLoopsInTypeHierarchy(supertypes.trueSupertypes); return Unit.INSTANCE$; } } @@ -585,12 +581,11 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes return supertypes.invoke().trueSupertypes; } - private void findAndDisconnectLoopsInTypeHierarchy(Supertypes supertypes) { - for (Iterator iterator = supertypes.trueSupertypes.iterator(); iterator.hasNext(); ) { + private void findAndDisconnectLoopsInTypeHierarchy(@Mutable Collection supertypes) { + for (Iterator iterator = supertypes.iterator(); iterator.hasNext(); ) { KotlinType supertype = iterator.next(); if (isReachable(supertype.getConstructor(), this, new HashSet())) { iterator.remove(); - supertypes.cyclicSupertypes.add(supertype); ClassifierDescriptor supertypeDescriptor = supertype.getConstructor().getDeclarationDescriptor(); if (supertypeDescriptor instanceof ClassDescriptor) {