Minor, rename TRAIT -> INTERFACE, CLASS_OBJECT -> COMPANION_OBJECT
This commit is contained in:
@@ -10004,9 +10004,9 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
CLASS(0, 0),
|
||||
/**
|
||||
* <code>TRAIT = 1;</code>
|
||||
* <code>INTERFACE = 1;</code>
|
||||
*/
|
||||
TRAIT(1, 1),
|
||||
INTERFACE(1, 1),
|
||||
/**
|
||||
* <code>ENUM_CLASS = 2;</code>
|
||||
*/
|
||||
@@ -10024,7 +10024,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
OBJECT(5, 5),
|
||||
/**
|
||||
* <code>CLASS_OBJECT = 6;</code>
|
||||
* <code>COMPANION_OBJECT = 6;</code>
|
||||
*/
|
||||
CLASS_OBJECT(6, 6),
|
||||
;
|
||||
@@ -10038,9 +10038,9 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public static final int CLASS_VALUE = 0;
|
||||
/**
|
||||
* <code>TRAIT = 1;</code>
|
||||
* <code>INTERFACE = 1;</code>
|
||||
*/
|
||||
public static final int TRAIT_VALUE = 1;
|
||||
public static final int INTERFACE_VALUE = 1;
|
||||
/**
|
||||
* <code>ENUM_CLASS = 2;</code>
|
||||
*/
|
||||
@@ -10058,7 +10058,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public static final int OBJECT_VALUE = 5;
|
||||
/**
|
||||
* <code>CLASS_OBJECT = 6;</code>
|
||||
* <code>COMPANION_OBJECT = 6;</code>
|
||||
*/
|
||||
public static final int CLASS_OBJECT_VALUE = 6;
|
||||
|
||||
@@ -10068,7 +10068,7 @@ public final class DebugProtoBuf {
|
||||
public static Kind valueOf(int value) {
|
||||
switch (value) {
|
||||
case 0: return CLASS;
|
||||
case 1: return TRAIT;
|
||||
case 1: return INTERFACE;
|
||||
case 2: return ENUM_CLASS;
|
||||
case 3: return ENUM_ENTRY;
|
||||
case 4: return ANNOTATION_CLASS;
|
||||
|
||||
+3
-4
@@ -31,8 +31,7 @@ import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.methodSignature
|
||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.propertySignature
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
import java.util.ArrayList
|
||||
import java.util.HashMap
|
||||
import java.util.*
|
||||
|
||||
public abstract class AbstractBinaryClassAnnotationAndConstantLoader<A : Any, C : Any, T : Any>(
|
||||
storageManager: StorageManager,
|
||||
@@ -203,11 +202,11 @@ public abstract class AbstractBinaryClassAnnotationAndConstantLoader<A : Any, C
|
||||
val classKind = Flags.CLASS_KIND[classProto.getFlags()]
|
||||
val classId = nameResolver.getClassId(classProto.getFqName())
|
||||
|
||||
if (classKind == ProtoBuf.Class.Kind.CLASS_OBJECT && isStaticFieldInOuter(proto) && seekForStaticFieldInOuter) {
|
||||
if (classKind == ProtoBuf.Class.Kind.COMPANION_OBJECT && isStaticFieldInOuter(proto) && seekForStaticFieldInOuter) {
|
||||
// Backing fields of properties of a companion object are generated in the outer class
|
||||
return kotlinClassFinder.findKotlinClass(classId.getOuterClassId())
|
||||
}
|
||||
else if (classKind == ProtoBuf.Class.Kind.TRAIT && (annotatedCallableKind == AnnotatedCallableKind.PROPERTY)) {
|
||||
else if (classKind == ProtoBuf.Class.Kind.INTERFACE && (annotatedCallableKind == AnnotatedCallableKind.PROPERTY)) {
|
||||
if (proto.hasExtension(implClassName)) {
|
||||
val parentPackageFqName = classId.getPackageFqName()
|
||||
val tImplName = nameResolver.getName(proto.getExtension(implClassName))
|
||||
|
||||
@@ -171,12 +171,12 @@ message Class {
|
||||
enum Kind {
|
||||
// 3 bits
|
||||
CLASS = 0;
|
||||
TRAIT = 1;
|
||||
INTERFACE = 1;
|
||||
ENUM_CLASS = 2;
|
||||
ENUM_ENTRY = 3;
|
||||
ANNOTATION_CLASS = 4;
|
||||
OBJECT = 5;
|
||||
CLASS_OBJECT = 6;
|
||||
COMPANION_OBJECT = 6;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -87,13 +87,13 @@ public class Flags {
|
||||
}
|
||||
|
||||
private static ProtoBuf.Class.Kind classKind(ClassKind kind, boolean isCompanionObject) {
|
||||
if (isCompanionObject) return ProtoBuf.Class.Kind.CLASS_OBJECT;
|
||||
if (isCompanionObject) return ProtoBuf.Class.Kind.COMPANION_OBJECT;
|
||||
|
||||
switch (kind) {
|
||||
case CLASS:
|
||||
return ProtoBuf.Class.Kind.CLASS;
|
||||
case INTERFACE:
|
||||
return ProtoBuf.Class.Kind.TRAIT;
|
||||
return ProtoBuf.Class.Kind.INTERFACE;
|
||||
case ENUM_CLASS:
|
||||
return ProtoBuf.Class.Kind.ENUM_CLASS;
|
||||
case ENUM_ENTRY:
|
||||
|
||||
@@ -7937,9 +7937,9 @@ public final class ProtoBuf {
|
||||
*/
|
||||
CLASS(0, 0),
|
||||
/**
|
||||
* <code>TRAIT = 1;</code>
|
||||
* <code>INTERFACE = 1;</code>
|
||||
*/
|
||||
TRAIT(1, 1),
|
||||
INTERFACE(1, 1),
|
||||
/**
|
||||
* <code>ENUM_CLASS = 2;</code>
|
||||
*/
|
||||
@@ -7957,9 +7957,9 @@ public final class ProtoBuf {
|
||||
*/
|
||||
OBJECT(5, 5),
|
||||
/**
|
||||
* <code>CLASS_OBJECT = 6;</code>
|
||||
* <code>COMPANION_OBJECT = 6;</code>
|
||||
*/
|
||||
CLASS_OBJECT(6, 6),
|
||||
COMPANION_OBJECT(6, 6),
|
||||
;
|
||||
|
||||
/**
|
||||
@@ -7971,9 +7971,9 @@ public final class ProtoBuf {
|
||||
*/
|
||||
public static final int CLASS_VALUE = 0;
|
||||
/**
|
||||
* <code>TRAIT = 1;</code>
|
||||
* <code>INTERFACE = 1;</code>
|
||||
*/
|
||||
public static final int TRAIT_VALUE = 1;
|
||||
public static final int INTERFACE_VALUE = 1;
|
||||
/**
|
||||
* <code>ENUM_CLASS = 2;</code>
|
||||
*/
|
||||
@@ -7991,9 +7991,9 @@ public final class ProtoBuf {
|
||||
*/
|
||||
public static final int OBJECT_VALUE = 5;
|
||||
/**
|
||||
* <code>CLASS_OBJECT = 6;</code>
|
||||
* <code>COMPANION_OBJECT = 6;</code>
|
||||
*/
|
||||
public static final int CLASS_OBJECT_VALUE = 6;
|
||||
public static final int COMPANION_OBJECT_VALUE = 6;
|
||||
|
||||
|
||||
public final int getNumber() { return value; }
|
||||
@@ -8001,12 +8001,12 @@ public final class ProtoBuf {
|
||||
public static Kind valueOf(int value) {
|
||||
switch (value) {
|
||||
case 0: return CLASS;
|
||||
case 1: return TRAIT;
|
||||
case 1: return INTERFACE;
|
||||
case 2: return ENUM_CLASS;
|
||||
case 3: return ENUM_ENTRY;
|
||||
case 4: return ANNOTATION_CLASS;
|
||||
case 5: return OBJECT;
|
||||
case 6: return CLASS_OBJECT;
|
||||
case 6: return COMPANION_OBJECT;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ public class DeserializedClassDescriptor(
|
||||
private val visibility = Deserialization.visibility(Flags.VISIBILITY.get(classProto.getFlags()))
|
||||
private val kindFromProto = Flags.CLASS_KIND.get(classProto.getFlags())
|
||||
private val kind = Deserialization.classKind(kindFromProto)
|
||||
private val isCompanion = kindFromProto == ProtoBuf.Class.Kind.CLASS_OBJECT
|
||||
private val isCompanion = kindFromProto == ProtoBuf.Class.Kind.COMPANION_OBJECT
|
||||
private val isInner = Flags.INNER.get(classProto.getFlags())
|
||||
|
||||
val c = outerContext.childContext(this, classProto.getTypeParameterList(), nameResolver)
|
||||
|
||||
+4
-4
@@ -16,11 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.serialization.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
@@ -54,11 +54,11 @@ object Deserialization {
|
||||
@JvmStatic
|
||||
fun classKind(kind: ProtoBuf.Class.Kind): ClassKind = when (kind) {
|
||||
ProtoBuf.Class.Kind.CLASS -> ClassKind.CLASS
|
||||
ProtoBuf.Class.Kind.TRAIT -> ClassKind.INTERFACE
|
||||
ProtoBuf.Class.Kind.INTERFACE -> ClassKind.INTERFACE
|
||||
ProtoBuf.Class.Kind.ENUM_CLASS -> ClassKind.ENUM_CLASS
|
||||
ProtoBuf.Class.Kind.ENUM_ENTRY -> ClassKind.ENUM_ENTRY
|
||||
ProtoBuf.Class.Kind.ANNOTATION_CLASS -> ClassKind.ANNOTATION_CLASS
|
||||
ProtoBuf.Class.Kind.OBJECT, ProtoBuf.Class.Kind.CLASS_OBJECT -> ClassKind.OBJECT
|
||||
ProtoBuf.Class.Kind.OBJECT, ProtoBuf.Class.Kind.COMPANION_OBJECT -> ClassKind.OBJECT
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
||||
+4
-4
@@ -96,14 +96,14 @@ private class ClassClsStubBuilder(
|
||||
}
|
||||
val additionalModifiers = when (classKind) {
|
||||
ProtoBuf.Class.Kind.ENUM_CLASS -> listOf(JetTokens.ENUM_KEYWORD)
|
||||
ProtoBuf.Class.Kind.CLASS_OBJECT -> listOf(JetTokens.COMPANION_KEYWORD)
|
||||
ProtoBuf.Class.Kind.COMPANION_OBJECT -> listOf(JetTokens.COMPANION_KEYWORD)
|
||||
else -> listOf<JetModifierKeywordToken>()
|
||||
}
|
||||
return createModifierListStubForDeclaration(parent, classProto.getFlags(), relevantFlags, additionalModifiers)
|
||||
}
|
||||
|
||||
private fun doCreateClassOrObjectStub(): StubElement<out PsiElement> {
|
||||
val isCompanionObject = classKind == ProtoBuf.Class.Kind.CLASS_OBJECT
|
||||
val isCompanionObject = classKind == ProtoBuf.Class.Kind.COMPANION_OBJECT
|
||||
val fqName = outerContext.containerFqName.child(classId.getShortClassName())
|
||||
val shortName = fqName.shortName().ref()
|
||||
val superTypeRefs = supertypeIds.filterNot {
|
||||
@@ -111,7 +111,7 @@ private class ClassClsStubBuilder(
|
||||
KotlinBuiltIns.isNumberedFunctionClassFqName(it.asSingleFqName().toUnsafe())
|
||||
}.map { it.getShortClassName().ref() }.toTypedArray()
|
||||
return when (classKind) {
|
||||
ProtoBuf.Class.Kind.OBJECT, ProtoBuf.Class.Kind.CLASS_OBJECT -> {
|
||||
ProtoBuf.Class.Kind.OBJECT, ProtoBuf.Class.Kind.COMPANION_OBJECT -> {
|
||||
KotlinObjectStubImpl(
|
||||
parentStub, shortName, fqName, superTypeRefs,
|
||||
isTopLevel = !classId.isNestedClass(),
|
||||
@@ -127,7 +127,7 @@ private class ClassClsStubBuilder(
|
||||
fqName.ref(),
|
||||
shortName,
|
||||
superTypeRefs,
|
||||
isTrait = classKind == ProtoBuf.Class.Kind.TRAIT,
|
||||
isTrait = classKind == ProtoBuf.Class.Kind.INTERFACE,
|
||||
isEnumEntry = classKind == ProtoBuf.Class.Kind.ENUM_ENTRY,
|
||||
isLocal = false,
|
||||
isTopLevel = !classId.isNestedClass()
|
||||
|
||||
Reference in New Issue
Block a user