diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/descriptors/KnownDescriptors.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/descriptors/KnownDescriptors.kt index 46a2deb1551..a7d5d065a6d 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/descriptors/KnownDescriptors.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/descriptors/KnownDescriptors.kt @@ -55,7 +55,7 @@ open class KnownClassDescriptor( fun initialize(declaredTypeParameters: List, supertypes: List) { this.declaredTypeParameters = declaredTypeParameters this.supertypes = supertypes - this.typeConstructor = ClassTypeConstructorImpl(this, true, declaredTypeParameters, supertypes) + this.typeConstructor = ClassTypeConstructorImpl(this, declaredTypeParameters, supertypes) this.defaultType = TypeUtils.makeUnsubstitutedType(this, unsubstitutedMemberScope) } diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/NotFoundClasses.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/NotFoundClasses.kt index 0efe6d13490..cccec98a941 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/NotFoundClasses.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/NotFoundClasses.kt @@ -67,7 +67,7 @@ class NotFoundClasses(private val storageManager: StorageManager, private val mo ) } - private val typeConstructor = ClassTypeConstructorImpl(this, /* isFinal = */ true, typeParameters, setOf(module.builtIns.anyType)) + private val typeConstructor = ClassTypeConstructorImpl(this, typeParameters, setOf(module.builtIns.anyType)) override fun getKind() = ClassKind.CLASS override fun getModality() = Modality.FINAL diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/ClassDescriptorImpl.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/ClassDescriptorImpl.java index f6130a71dd7..9776753b34e 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/ClassDescriptorImpl.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/ClassDescriptorImpl.java @@ -55,7 +55,7 @@ public class ClassDescriptorImpl extends ClassDescriptorBase { this.modality = modality; this.kind = kind; - this.typeConstructor = new ClassTypeConstructorImpl(this, false, Collections.emptyList(), supertypes); + this.typeConstructor = new ClassTypeConstructorImpl(this, Collections.emptyList(), supertypes); } public final void initialize( diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/EnumEntrySyntheticClassDescriptor.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/EnumEntrySyntheticClassDescriptor.java index d44088542c7..b12098749fa 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/EnumEntrySyntheticClassDescriptor.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/EnumEntrySyntheticClassDescriptor.java @@ -80,7 +80,7 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase { this.annotations = annotations; this.typeConstructor = new ClassTypeConstructorImpl( - this, true, Collections.emptyList(), Collections.singleton(supertype) + this, Collections.emptyList(), Collections.singleton(supertype) ); this.scope = new EnumEntryScope(storageManager); diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/LazySubstitutingClassDescriptor.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/LazySubstitutingClassDescriptor.java index 35412c9ed55..329a2c7a0ce 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/LazySubstitutingClassDescriptor.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/LazySubstitutingClassDescriptor.java @@ -84,7 +84,7 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor { supertypes.add(substitutor.substitute(supertype, Variance.INVARIANT)); } - typeConstructor = new ClassTypeConstructorImpl(this, originalTypeConstructor.isFinal(), typeConstructorParameters, supertypes); + typeConstructor = new ClassTypeConstructorImpl(this, typeConstructorParameters, supertypes); } return typeConstructor; diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/MutableClassDescriptor.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/MutableClassDescriptor.java index 6d176d594cf..4aa0d5aaf7b 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/MutableClassDescriptor.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/MutableClassDescriptor.java @@ -157,7 +157,7 @@ public class MutableClassDescriptor extends ClassDescriptorBase { public void createTypeConstructor() { assert typeConstructor == null : typeConstructor; - this.typeConstructor = new ClassTypeConstructorImpl(this, ModalityKt.isFinalClass(this), typeParameters, supertypes); + this.typeConstructor = new ClassTypeConstructorImpl(this, typeParameters, supertypes); for (FunctionDescriptor functionDescriptor : getConstructors()) { ((ClassConstructorDescriptorImpl) functionDescriptor).setReturnType(getDefaultType()); } diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/ClassTypeConstructorImpl.java b/core/descriptors/src/org/jetbrains/kotlin/types/ClassTypeConstructorImpl.java index c61a937c0e6..fb46eea230b 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/ClassTypeConstructorImpl.java +++ b/core/descriptors/src/org/jetbrains/kotlin/types/ClassTypeConstructorImpl.java @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.types; import org.jetbrains.annotations.NotNull; import org.jetbrains.kotlin.descriptors.ClassDescriptor; +import org.jetbrains.kotlin.descriptors.Modality; import org.jetbrains.kotlin.descriptors.SupertypeLoopChecker; import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor; import org.jetbrains.kotlin.resolve.DescriptorUtils; @@ -32,17 +33,14 @@ public class ClassTypeConstructorImpl extends AbstractClassTypeConstructor imple private final ClassDescriptor classDescriptor; private final List parameters; private final Collection supertypes; - private final boolean isFinal; public ClassTypeConstructorImpl( @NotNull ClassDescriptor classDescriptor, - boolean isFinal, @NotNull List parameters, @NotNull Collection supertypes ) { super(LockBasedStorageManager.NO_LOCKS); this.classDescriptor = classDescriptor; - this.isFinal = isFinal; this.parameters = Collections.unmodifiableList(new ArrayList(parameters)); this.supertypes = Collections.unmodifiableCollection(supertypes); } @@ -60,7 +58,7 @@ public class ClassTypeConstructorImpl extends AbstractClassTypeConstructor imple @Override public boolean isFinal() { - return isFinal; + return classDescriptor.getModality() == Modality.FINAL; } @Override