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
|
if (DescriptorUtils.isLocal(descriptor)) return null
|
||||||
val classDescriptorImpl = ClassDescriptorImpl(
|
val classDescriptorImpl = ClassDescriptorImpl(
|
||||||
descriptor, Name.identifier(JvmAbi.DEFAULT_IMPLS_CLASS_NAME),
|
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)
|
classDescriptorImpl.initialize(MemberScope.Empty, emptySet(), null)
|
||||||
return classDescriptorImpl
|
return classDescriptorImpl
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public class SamWrapperCodegen {
|
|||||||
samType.getJavaClassDescriptor().getContainingDeclaration(),
|
samType.getJavaClassDescriptor().getContainingDeclaration(),
|
||||||
fqName.shortName(),
|
fqName.shortName(),
|
||||||
Modality.FINAL,
|
Modality.FINAL,
|
||||||
|
ClassKind.CLASS,
|
||||||
Collections.singleton(samType.getType()),
|
Collections.singleton(samType.getType()),
|
||||||
SourceElement.NO_SOURCE
|
SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
|
|||||||
+1
@@ -98,6 +98,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
|||||||
correctContainerForLambda(callableDescriptor, element),
|
correctContainerForLambda(callableDescriptor, element),
|
||||||
Name.special("<closure-" + simpleName + ">"),
|
Name.special("<closure-" + simpleName + ">"),
|
||||||
Modality.FINAL,
|
Modality.FINAL,
|
||||||
|
ClassKind.CLASS,
|
||||||
supertypes,
|
supertypes,
|
||||||
KotlinSourceElementKt.toSourceElement(element)
|
KotlinSourceElementKt.toSourceElement(element)
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-1
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.load.kotlin
|
package org.jetbrains.kotlin.load.kotlin
|
||||||
|
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
|
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.SourceElement
|
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||||
@@ -53,7 +54,7 @@ class BuiltInClassesAreSerializableOnJvm(
|
|||||||
})
|
})
|
||||||
|
|
||||||
val mockSerializableClass = ClassDescriptorImpl(
|
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)
|
mockSerializableClass.initialize(MemberScope.Empty, emptySet(), null)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class ClassDescriptorImpl extends ClassDescriptorBase {
|
public class ClassDescriptorImpl extends ClassDescriptorBase {
|
||||||
private final Modality modality;
|
private final Modality modality;
|
||||||
|
private final ClassKind kind;
|
||||||
private final TypeConstructor typeConstructor;
|
private final TypeConstructor typeConstructor;
|
||||||
private final MemberScope staticScope = new StaticScopeForKotlinClass(this);
|
private final MemberScope staticScope = new StaticScopeForKotlinClass(this);
|
||||||
|
|
||||||
@@ -46,11 +47,13 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
|
|||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull Modality modality,
|
@NotNull Modality modality,
|
||||||
|
@NotNull ClassKind kind,
|
||||||
@NotNull Collection<KotlinType> supertypes,
|
@NotNull Collection<KotlinType> supertypes,
|
||||||
@NotNull SourceElement source
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(LockBasedStorageManager.NO_LOCKS, containingDeclaration, name, source);
|
super(LockBasedStorageManager.NO_LOCKS, containingDeclaration, name, source);
|
||||||
this.modality = modality;
|
this.modality = modality;
|
||||||
|
this.kind = kind;
|
||||||
|
|
||||||
this.typeConstructor = TypeConstructorImpl.createForClass(this, Annotations.Companion.getEMPTY(), false, getName().asString(),
|
this.typeConstructor = TypeConstructorImpl.createForClass(this, Annotations.Companion.getEMPTY(), false, getName().asString(),
|
||||||
Collections.<TypeParameterDescriptor>emptyList(), supertypes);
|
Collections.<TypeParameterDescriptor>emptyList(), supertypes);
|
||||||
@@ -109,7 +112,7 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public ClassKind getKind() {
|
public ClassKind getKind() {
|
||||||
return ClassKind.CLASS;
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ public class ErrorUtils {
|
|||||||
private static class ErrorClassDescriptor extends ClassDescriptorImpl {
|
private static class ErrorClassDescriptor extends ClassDescriptorImpl {
|
||||||
public ErrorClassDescriptor(@Nullable String name) {
|
public ErrorClassDescriptor(@Nullable String name) {
|
||||||
super(getErrorModule(), Name.special(name == null ? "<ERROR CLASS>" : "<ERROR CLASS: " + 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);
|
ConstructorDescriptorImpl errorConstructor = ConstructorDescriptorImpl.create(this, Annotations.Companion.getEMPTY(), true, SourceElement.NO_SOURCE);
|
||||||
errorConstructor.initialize(Collections.<ValueParameterDescriptor>emptyList(),
|
errorConstructor.initialize(Collections.<ValueParameterDescriptor>emptyList(),
|
||||||
|
|||||||
+1
-1
@@ -63,7 +63,7 @@ internal class PackageFragmentProviderForMissingDependencies(val moduleDescripto
|
|||||||
private class MissingDependencyErrorClassDescriptor(
|
private class MissingDependencyErrorClassDescriptor(
|
||||||
containing: DeclarationDescriptor,
|
containing: DeclarationDescriptor,
|
||||||
override val fullFqName: FqName
|
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)
|
private val scope = ScopeWithMissingDependencies(fullFqName, this)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user