Fix ClassKind for Serializable and change ClassKind to INTERFACE for error classes.
This commit is contained in:
@@ -63,7 +63,7 @@ public class InterfaceImplBodyCodegen(
|
||||
if (DescriptorUtils.isLocal(descriptor)) return null
|
||||
val classDescriptorImpl = ClassDescriptorImpl(
|
||||
descriptor, Name.identifier(JvmAbi.DEFAULT_IMPLS_CLASS_NAME),
|
||||
Modality.FINAL, Collections.emptyList(), SourceElement.NO_SOURCE)
|
||||
Modality.FINAL, ClassKind.CLASS, Collections.emptyList(), SourceElement.NO_SOURCE)
|
||||
|
||||
classDescriptorImpl.initialize(MemberScope.Empty, emptySet(), null)
|
||||
return classDescriptorImpl
|
||||
|
||||
@@ -70,6 +70,7 @@ public class SamWrapperCodegen {
|
||||
samType.getJavaClassDescriptor().getContainingDeclaration(),
|
||||
fqName.shortName(),
|
||||
Modality.FINAL,
|
||||
ClassKind.CLASS,
|
||||
Collections.singleton(samType.getType()),
|
||||
SourceElement.NO_SOURCE
|
||||
);
|
||||
|
||||
+1
@@ -98,6 +98,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
correctContainerForLambda(callableDescriptor, element),
|
||||
Name.special("<closure-" + simpleName + ">"),
|
||||
Modality.FINAL,
|
||||
ClassKind.CLASS,
|
||||
supertypes,
|
||||
KotlinSourceElementKt.toSourceElement(element)
|
||||
);
|
||||
|
||||
+2
-1
@@ -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(),
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ internal class PackageFragmentProviderForMissingDependencies(val moduleDescripto
|
||||
private class MissingDependencyErrorClassDescriptor(
|
||||
containing: DeclarationDescriptor,
|
||||
override val fullFqName: FqName
|
||||
) : MissingDependencyErrorClass, ClassDescriptorImpl(containing, fullFqName.shortName(), Modality.OPEN, listOf(), SourceElement.NO_SOURCE) {
|
||||
) : MissingDependencyErrorClass, ClassDescriptorImpl(containing, fullFqName.shortName(), Modality.OPEN, ClassKind.CLASS, listOf(), SourceElement.NO_SOURCE) {
|
||||
|
||||
private val scope = ScopeWithMissingDependencies(fullFqName, this)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user