Fix ClassKind for Serializable and change ClassKind to INTERFACE for error classes.

This commit is contained in:
Stanislav Erokhin
2015-12-04 21:27:46 +03:00
parent f2e60a0e11
commit 11c86405bf
7 changed files with 11 additions and 5 deletions
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.load.kotlin
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.SourceElement
@@ -53,7 +54,7 @@ class BuiltInClassesAreSerializableOnJvm(
})
val mockSerializableClass = ClassDescriptorImpl(
mockJavaIoPackageFragment, Name.identifier("Serializable"), Modality.ABSTRACT, superTypes, SourceElement.NO_SOURCE
mockJavaIoPackageFragment, Name.identifier("Serializable"), Modality.ABSTRACT, ClassKind.INTERFACE, superTypes, SourceElement.NO_SOURCE
)
mockSerializableClass.initialize(MemberScope.Empty, emptySet(), null)
@@ -35,6 +35,7 @@ import java.util.Set;
public class ClassDescriptorImpl extends ClassDescriptorBase {
private final Modality modality;
private final ClassKind kind;
private final TypeConstructor typeConstructor;
private final MemberScope staticScope = new StaticScopeForKotlinClass(this);
@@ -46,11 +47,13 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
@NotNull DeclarationDescriptor containingDeclaration,
@NotNull Name name,
@NotNull Modality modality,
@NotNull ClassKind kind,
@NotNull Collection<KotlinType> supertypes,
@NotNull SourceElement source
) {
super(LockBasedStorageManager.NO_LOCKS, containingDeclaration, name, source);
this.modality = modality;
this.kind = kind;
this.typeConstructor = TypeConstructorImpl.createForClass(this, Annotations.Companion.getEMPTY(), false, getName().asString(),
Collections.<TypeParameterDescriptor>emptyList(), supertypes);
@@ -109,7 +112,7 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
@NotNull
@Override
public ClassKind getKind() {
return ClassKind.CLASS;
return kind;
}
@Override
@@ -255,7 +255,7 @@ public class ErrorUtils {
private static class ErrorClassDescriptor extends ClassDescriptorImpl {
public ErrorClassDescriptor(@Nullable String name) {
super(getErrorModule(), Name.special(name == null ? "<ERROR CLASS>" : "<ERROR CLASS: " + name + ">"),
Modality.OPEN, Collections.<KotlinType>emptyList(), SourceElement.NO_SOURCE);
Modality.OPEN, ClassKind.CLASS, Collections.<KotlinType>emptyList(), SourceElement.NO_SOURCE);
ConstructorDescriptorImpl errorConstructor = ConstructorDescriptorImpl.create(this, Annotations.Companion.getEMPTY(), true, SourceElement.NO_SOURCE);
errorConstructor.initialize(Collections.<ValueParameterDescriptor>emptyList(),