Expect/actual support in klibs under -Xklib-mpp

This commit is contained in:
Alexander Gorshenev
2019-10-28 17:34:52 +03:00
committed by alexander-gorshenev
parent 218d7c31ed
commit dc8240c24e
49 changed files with 2623 additions and 74 deletions
@@ -81,6 +81,7 @@ message IrFile {
repeated int32 fq_name = 3;
repeated IrConstructorCall annotation = 4;
repeated int32 explicitly_exported_to_compiler = 5;
repeated Actual actuals = 6;
}
/* ------ IrSymbols --------------------------------------------- */
@@ -113,6 +114,11 @@ message IrSymbolData {
optional DescriptorReference descriptor_reference = 7;
}
message Actual {
required int32 actual_symbol = 1;
required int32 expect_symbol = 2;
}
/* ------ IrTypes --------------------------------------------- */
enum IrTypeVariance { // Should we import metadata variance, or better stay separate?
@@ -14,7 +14,8 @@ enum class DescriptorReferenceFlags {
IS_DEFAULT_CONSTRUCTOR,
IS_ENUM_ENTRY,
IS_ENUM_SPECIAL,
IS_TYPE_PARAMETER;
IS_TYPE_PARAMETER,
IS_EXPECT;
fun encode(isSet: Boolean): Int = if (isSet) 1 shl ordinal else 0
fun decode(flags: Int): Boolean = (flags and (1 shl ordinal) != 0)
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.multiplatform.ExpectedActualResolver
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
@@ -87,6 +88,21 @@ abstract class DescriptorReferenceDeserializer(
return ClassMembers(classConstructorDescriptor, allMembersMap, realMembersMap)
}
// TODO: the real findExpects() returns a list.
// Need to account for multiple expects here.
private fun MemberDescriptor.toExpect() =
if (this.isExpect)
this
else
ExpectedActualResolver.findExpectedForActual(
this,
currentModule,
{ true }
)?.get(ExpectedActualResolver.Compatibility.Compatible)?.single()
private fun Collection<DeclarationDescriptor>.toExpects() = this.map { (it as MemberDescriptor).toExpect() }.filterNotNull().distinct()
open fun deserializeDescriptorReference(
packageFqName: FqName,
classFqName: FqName,
@@ -98,10 +114,21 @@ abstract class DescriptorReferenceDeserializer(
val protoIndex = index
val (clazz, members) = if (classFqName.isRoot) {
Pair(null, getContributedDescriptors(packageFqName, name))
Pair(null,
getContributedDescriptors(packageFqName, name).let {
if (DescriptorReferenceFlags.IS_EXPECT.decode(flags)) it.toExpects() else it
}
)
} else {
val clazz = currentModule.findClassAcrossModuleDependencies(ClassId(packageFqName, classFqName, false))!!
Pair(clazz, getContributedDescriptors(clazz.unsubstitutedMemberScope, name) + clazz.getConstructors())
val classifier = (currentModule.findClassifierAcrossModuleDependencies(ClassId(packageFqName, classFqName, false)) as? MemberDescriptor)
?: error("Could not find class across modules: $packageFqName/$classFqName")
val expect = if (DescriptorReferenceFlags.IS_EXPECT.decode(flags)) {
classifier.toExpect()
} else null
val expectOrActualClass = (expect as ClassDescriptor?) ?: (classifier as ClassDescriptor) // TODO: OMG!!!
Pair(expectOrActualClass, getContributedDescriptors(expectOrActualClass.unsubstitutedMemberScope, name) + expectOrActualClass.getConstructors())
}
// TODO: This is still native specific. Eliminate.
@@ -157,7 +184,7 @@ abstract class DescriptorReferenceDeserializer(
val membersWithIndices = getMembers(members)
return when {
val result = when {
DescriptorReferenceFlags.IS_DEFAULT_CONSTRUCTOR.decode(flags) -> membersWithIndices.defaultConstructor
else -> {
@@ -172,5 +199,11 @@ abstract class DescriptorReferenceDeserializer(
}
} ?:
error("Could not find serialized descriptor for index: ${index} ${packageFqName},${classFqName},${name}")
// TODO: why we don't have "expect" bit on all the expect declarations?
//if (DescriptorReferenceFlags.IS_EXPECT.decode(flags)) assert(if (result is ClassConstructorDescriptor) result.constructedClass.isExpect() else result.isExpectMember) {
// "expected expect, found $result"
//}
return result
}
}
@@ -0,0 +1,120 @@
package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.types.classOrNull
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
import org.jetbrains.kotlin.ir.visitors.acceptVoid
import org.jetbrains.kotlin.resolve.descriptorUtil.module
import org.jetbrains.kotlin.resolve.multiplatform.findActuals
import org.jetbrains.kotlin.resolve.multiplatform.findExpects
class ExpectActualTable(val expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>) {
val table = mutableMapOf<DeclarationDescriptor, IrSymbol>()
private fun IrElement.recordActuals(rightHandSide: Map<DeclarationDescriptor, IrSymbol>, inModule: ModuleDescriptor) {
this.acceptVoid(object : IrElementVisitorVoid {
private fun recordDeclarationActuals(declaration: IrDeclaration) {
expectDescriptorToSymbol.put(declaration.descriptor, (declaration as IrSymbolOwner).symbol)
declaration.descriptor.findActuals(inModule).forEach {
val realActual = if (it is TypeAliasDescriptor)
it.expandedType.constructor.declarationDescriptor as? ClassDescriptor
?: error("Unexpected actual typealias right hand side: $it")
else it
// TODO: what to do with fake overrides???
if (!(realActual is CallableMemberDescriptor && realActual.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE)) {
table.put(
declaration.descriptor, rightHandSide[realActual]
?: error("Could not find actual type alias target member for: ${declaration.descriptor} -> $it")
)
}
}
}
override fun visitElement(element: IrElement) {
element.acceptChildrenVoid(this)
}
override fun visitFunction(declaration: IrFunction) {
recordDeclarationActuals(declaration)
super.visitFunction(declaration)
}
override fun visitClass(declaration: IrClass) {
recordDeclarationActuals(declaration)
super.visitClass(declaration)
}
override fun visitProperty(declaration: IrProperty) {
recordDeclarationActuals(declaration)
super.visitProperty(declaration)
}
override fun visitEnumEntry(declaration: IrEnumEntry) {
recordDeclarationActuals(declaration)
super.visitEnumEntry(declaration)
}
})
}
private fun IrDeclaration.recordRightHandSide(): Map<DeclarationDescriptor, IrSymbol> {
val rightHandSide = mutableMapOf<DeclarationDescriptor, IrSymbol>()
this.acceptVoid(object : IrElementVisitorVoid {
override fun visitElement(element: IrElement) {
element.acceptChildrenVoid(this)
}
override fun visitFunction(declaration: IrFunction) {
rightHandSide.put(declaration.descriptor, declaration.symbol)
super.visitFunction(declaration)
}
override fun visitClass(declaration: IrClass) {
rightHandSide.put(declaration.descriptor, declaration.symbol)
super.visitClass(declaration)
}
override fun visitProperty(declaration: IrProperty) {
rightHandSide.put(declaration.descriptor, declaration.symbol)
super.visitProperty(declaration)
}
override fun visitEnumEntry(declaration: IrEnumEntry) {
rightHandSide.put(declaration.descriptor, declaration.symbol)
super.visitEnumEntry(declaration)
}
})
return rightHandSide
}
fun findExpectsForActuals(declaration: IrDeclaration) {
if (declaration.descriptor !is MemberDescriptor) return
if (declaration !is IrSymbolDeclaration<*>) return
val descriptor = declaration.symbol.descriptor
if (declaration is IrTypeAlias && declaration.isActual) {
val rightHandSide = declaration.expandedType.classOrNull?.owner?.recordRightHandSide()
?: error("Unexpected right hand side of actual typealias: ${declaration.descriptor}")
declaration.descriptor.findExpects().forEach {
expectDescriptorToSymbol[it]?.owner?.recordActuals(rightHandSide, declaration.descriptor.module)
}
return
}
val expects: List<MemberDescriptor> = if (descriptor is ClassConstructorDescriptor && descriptor.isPrimary) {
(descriptor.containingDeclaration.findExpects() as List<ClassDescriptor>).map {
it.unsubstitutedPrimaryConstructor
}.filterNotNull()
} else {
descriptor.findExpects()
}
expects.forEach { expect ->
table.put(expect, declaration.symbol)
}
}
}
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.findTopLevelDeclaration
import org.jetbrains.kotlin.ir.util.lineStartOffsets
import org.jetbrains.kotlin.ir.util.module
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
import org.jetbrains.kotlin.ir.visitors.acceptVoid
@@ -115,16 +116,22 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.ModalityKind as P
import org.jetbrains.kotlin.backend.common.serialization.proto.NullableIrExpression as ProtoNullableIrExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.TypeArguments as ProtoTypeArguments
import org.jetbrains.kotlin.backend.common.serialization.proto.Visibility as ProtoVisibility
import org.jetbrains.kotlin.backend.common.serialization.proto.Actual as ProtoActual
open class IrFileSerializer(
val logger: LoggingContext,
private val declarationTable: DeclarationTable,
private val bodiesOnlyForInlines: Boolean = false
private val expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>,
private val bodiesOnlyForInlines: Boolean = false,
private val skipExpects: Boolean = false
) {
private val loopIndex = mutableMapOf<IrLoop, Int>()
private var currentLoopIndex = 0
// For every actual we keep a corresponding expects' uniqIds.
// The linker substitutes actual symbols when asked for an expect uniqId.
private val expectActualTable = ExpectActualTable(expectDescriptorToSymbol)
// The same symbol can be used multiple times in a file
// so use this index to store symbol data only once.
private val protoSymbolMap = mutableMapOf<IrSymbol, Int>()
@@ -141,7 +148,7 @@ open class IrFileSerializer(
private val protoBodyArray = mutableListOf<XStatementOrExpression>()
private val descriptorReferenceSerializer =
DescriptorReferenceSerializer(declarationTable, { serializeString(it) }, { serializeFqName(it) })
DescriptorReferenceSerializer(declarationTable, { serializeString(it) }, { serializeFqName(it) }, skipExpects)
sealed class XStatementOrExpression {
abstract fun toByteArray(): ByteArray
@@ -984,13 +991,15 @@ open class IrFileSerializer(
return proto.build()
}
private fun serializeIrDeclarationBase(declaration: IrDeclaration) =
ProtoDeclarationBase.newBuilder()
private fun serializeIrDeclarationBase(declaration: IrDeclaration): ProtoDeclarationBase {
expectActualTable.findExpectsForActuals(declaration)
return ProtoDeclarationBase.newBuilder()
.setSymbol(serializeIrSymbol((declaration as IrSymbolOwner).symbol))
.setCoordinates(serializeCoordinates(declaration.startOffset, declaration.endOffset))
.addAllAnnotation(serializeAnnotations(declaration.annotations))
.setOrigin(serializeIrDeclarationOrigin(declaration.origin))
.build()
}
private fun serializeIrValueParameter(parameter: IrValueParameter): ProtoValueParameter {
val proto = ProtoValueParameter.newBuilder()
@@ -1280,7 +1289,7 @@ open class IrFileSerializer(
.addAllAnnotation(serializeAnnotations(file.annotations))
file.declarations.forEach {
if (it.descriptor.isExpectMember && !it.descriptor.isSerializableExpectClass) {
if (skipExpects && it.descriptor.isExpectMember && !it.descriptor.isSerializableExpectClass) {
topLevelDeclarations.add(SkippedDeclaration)
return@forEach
}
@@ -1323,6 +1332,8 @@ open class IrFileSerializer(
}
})
serializeExpectActualSubstitutionTable(proto)
return SerializedIrFile(
proto.build().toByteArray(),
file.fqName.asString(),
@@ -1334,4 +1345,23 @@ open class IrFileSerializer(
IrMemoryDeclarationWriter(topLevelDeclarations).writeIntoMemory()
)
}
fun serializeExpectActualSubstitutionTable(proto: ProtoFile.Builder) {
if (skipExpects) return
expectActualTable.table.forEach next@{ (expect, actualSymbol) ->
val expectSymbol = expectDescriptorToSymbol[expect]
?: error("Could not find expect symbol for expect descriptor $expect")
val expectDeclaration = expectSymbol.owner as IrDeclaration
val actualDeclaration = actualSymbol.owner as IrDeclaration
proto.addActuals(
ProtoActual.newBuilder()
.setExpectSymbol(serializeIrSymbol(expectSymbol))
.setActualSymbol(serializeIrSymbol(actualSymbol))
.build()
)
}
}
}
@@ -10,9 +10,7 @@ import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.impl.EmptyPackageFragmentDescriptor
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl
import org.jetbrains.kotlin.ir.declarations.impl.IrFileImpl
import org.jetbrains.kotlin.ir.declarations.impl.IrModuleFragmentImpl
@@ -21,8 +19,7 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrErrorExpressionImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrLoopBase
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.symbols.impl.*
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.impl.IrErrorTypeImpl
@@ -41,6 +38,7 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrType as ProtoTy
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement as ProtoStatement
import org.jetbrains.kotlin.backend.common.serialization.proto.IrExpression as ProtoExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructorCall as ProtoConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.Actual as ProtoActual
abstract class KotlinIrLinker(
val logger: LoggingContext,
@@ -51,6 +49,10 @@ abstract class KotlinIrLinker(
mangler: KotlinMangler
) : DescriptorUniqIdAware, IrDeserializer {
private val expectUniqIdToActualUniqId = mutableMapOf<UniqId, UniqId>()
private val topLevelActualUniqItToDeserializer = mutableMapOf<UniqId, IrModuleDeserializer>()
private val expectSymbols = mutableMapOf<UniqId, IrSymbol>()
private val actualSymbols = mutableMapOf<UniqId, IrSymbol>()
sealed class DeserializationState<T> {
val deserializedSymbols = mutableMapOf<UniqId, IrSymbol>()
@@ -139,6 +141,7 @@ abstract class KotlinIrLinker(
inner class IrDeserializerForFile(
private var annotations: List<ProtoConstructorCall>?,
private val actuals: List<ProtoActual>,
private val fileIndex: Int,
onlyHeaders: Boolean
) : IrFileDeserializer(logger, builtIns, symbolTable) {
@@ -161,6 +164,21 @@ abstract class KotlinIrLinker(
return deserializeDeclaration(loadTopLevelDeclarationProto(key), file)
}
fun deserializeExpectActualMapping() {
actuals.forEach {
val expectSymbol = loadSymbolProto(it.expectSymbol)
val actualSymbol = loadSymbolProto(it.actualSymbol)
val expect = UniqId(expectSymbol.uniqIdIndex)
val actual = UniqId(actualSymbol.uniqIdIndex)
assert(expectUniqIdToActualUniqId[expect] == null) {
"Expect uniqid ${expect.index} is already actualized by ${expectUniqIdToActualUniqId[expect]?.index}, while we try to record ${actual.index}"
}
expectUniqIdToActualUniqId.put(expect, actual)
// Non-null only for topLevel declarations.
getModuleForTopLevelId(actual)?. let { topLevelActualUniqItToDeserializer.put(actual, it) }
}
}
private fun loadTopLevelDeclarationProto(uniqId: UniqId): ProtoDeclaration {
val stream = reader(moduleDescriptor, fileIndex, uniqId).codedInputStream
return ProtoDeclaration.parseFrom(stream, newInstance())
@@ -323,7 +341,14 @@ abstract class KotlinIrLinker(
if (it !in fdState) fdState.addUniqID(it)
}
referenceDeserializedSymbol(proto, descriptor)
val symbol = referenceDeserializedSymbol(proto, descriptor).let {
if (expectUniqIdToActualUniqId[key] != null) wrapInDelegatedSymbol(it) else it
}
if (key in expectUniqIdToActualUniqId.keys) expectSymbols.put(key, symbol)
if (key in expectUniqIdToActualUniqId.values) actualSymbols.put(key, symbol)
symbol
}
if (symbol.descriptor is ClassDescriptor &&
symbol.descriptor !is WrappedDeclarationDescriptor<*> &&
@@ -402,7 +427,8 @@ abstract class KotlinIrLinker(
val fileEntry = NaiveSourceBasedFileEntryImpl(fileName, fileProto.fileEntry.lineStartOffsetsList.toIntArray())
val fileDeserializer =
IrDeserializerForFile(fileProto.annotationList, fileIndex, !deserializationStrategy.needBodies).apply {
IrDeserializerForFile(fileProto.annotationList, fileProto.actualsList, fileIndex, !deserializationStrategy.needBodies).apply {
// Explicitly exported declarations (e.g. top-level initializers) must be deserialized before all other declarations.
// Thus we schedule their deserialization in deserializer's constructor.
fileProto.explicitlyExportedToCompilerList.forEach {
@@ -555,8 +581,11 @@ abstract class KotlinIrLinker(
findDeserializedDeclarationForDescriptor(symbol.descriptor) ?: return null
}
// TODO: we do have serializations for those, but let's just create a stub for now.
if (!symbol.isBound && (symbol.descriptor.isExpectMember || symbol.descriptor.containingDeclaration?.isExpectMember ?: false)) return null
assert(symbol.isBound) {
"findDeserializedDeclaration: symbol ${symbol} is unbound, descriptor = ${symbol.descriptor}, hash = ${symbol.descriptor.hashCode()}"
"getDeclaration: symbol ${symbol} is unbound, descriptor = ${symbol.descriptor}, hash = ${symbol.descriptor.hashCode()}"
}
return symbol.owner as IrDeclaration
@@ -597,6 +626,49 @@ abstract class KotlinIrLinker(
}
}
fun initializeExpectActualLinker() {
deserializersForModules.values.forEach {
it.fileToDeserializerMap.values.forEach {
it.deserializeExpectActualMapping()
}
}
}
// The issue here is that an expect can not trigger its actual deserialization by reachability
// because the expect can not see the actual higher in the module dependency dag.
// So we force deserialization of actuals for all deserialized expect symbols here.
fun finalizeExpectActualLinker() {
expectUniqIdToActualUniqId.filter{ topLevelActualUniqItToDeserializer[it.value] != null}.forEach {
val expectSymbol = expectSymbols[it.key]
val actualSymbol = actualSymbols[it.value]
if (expectSymbol != null && (actualSymbol == null || !actualSymbol.isBound)) {
topLevelActualUniqItToDeserializer[it.value]!!.addModuleReachableTopLevel(it.value)
deserializeAllReachableTopLevels()
}
}
// Now after all actuals have been deserialized, retarget delegating symbols from expects to actuals.
expectUniqIdToActualUniqId.forEach {
val expectSymbol = expectSymbols[it.key]
val actualSymbol = actualSymbols[it.value]
if (expectSymbol != null && actualSymbol != null) {
when (expectSymbol) {
is IrDelegatingClassSymbolImpl ->
expectSymbol.delegate = actualSymbol as IrClassSymbol
is IrDelegatingEnumEntrySymbolImpl ->
expectSymbol.delegate = actualSymbol as IrEnumEntrySymbol
is IrDelegatingSimpleFunctionSymbolImpl ->
expectSymbol.delegate = actualSymbol as IrSimpleFunctionSymbol
is IrDelegatingConstructorSymbolImpl ->
expectSymbol.delegate = actualSymbol as IrConstructorSymbol
is IrDelegatingPropertySymbolImpl ->
expectSymbol.delegate = actualSymbol as IrPropertySymbol
else -> error("Unexpected expect symbol kind during actualization: $expectSymbol")
}
}
}
}
fun deserializeIrModuleHeader(
moduleDescriptor: ModuleDescriptor,
deserializationStrategy: DeserializationStrategy = DeserializationStrategy.ONLY_REFERENCED
@@ -5,6 +5,8 @@
package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.backend.common.ir.isExpect
import org.jetbrains.kotlin.backend.common.ir.isProperExpect
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.*
@@ -296,7 +298,10 @@ abstract class KotlinManglerImpl : KotlinMangler {
is IrTypeParameter -> this.symbolName
is IrTypeAlias -> this.symbolName
else -> error("Unexpected exported declaration: $this")
}
} + expectPart
// TODO: need to figure out the proper OptionalExpectation behavior
private val IrDeclaration.expectPart get() = if (this.isProperExpect) "#expect" else ""
private val IrDeclarationParent.fqNameUnique: FqName
get() = when (this) {
@@ -5,6 +5,8 @@
package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.backend.common.ir.isExpect
import org.jetbrains.kotlin.backend.common.ir.isProperExpect
import org.jetbrains.kotlin.backend.common.serialization.proto.DescriptorReference as ProtoDescriptorReference
import org.jetbrains.kotlin.descriptors.*
@@ -20,7 +22,8 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.classId
open class DescriptorReferenceSerializer(
val declarationTable: DeclarationTable,
val serializeString: (String) -> Int,
val serializeFqName: (FqName) -> List<Int>
val serializeFqName: (FqName) -> List<Int>,
val skipExpects: Boolean
) {
private fun isEnumSpecialMember(descriptor: DeclarationDescriptor): Boolean {
@@ -122,8 +125,8 @@ open class DescriptorReferenceSerializer(
DescriptorReferenceFlags.IS_DEFAULT_CONSTRUCTOR.encode(isDefaultConstructor) or
DescriptorReferenceFlags.IS_ENUM_ENTRY.encode(isEnumEntry) or
DescriptorReferenceFlags.IS_ENUM_SPECIAL.encode(isEnumSpecial) or
DescriptorReferenceFlags.IS_TYPE_PARAMETER.encode(isTypeParameter)
DescriptorReferenceFlags.IS_TYPE_PARAMETER.encode(isTypeParameter) or
DescriptorReferenceFlags.IS_EXPECT.encode(!skipExpects && declaration.isProperExpect)
proto.flags = flags
if (uniqId != null) proto.uniqIdIndex = uniqId.index
@@ -6,8 +6,6 @@
package org.jetbrains.kotlin.ir.backend.js.lower.serialization.metadata
import org.jetbrains.kotlin.backend.common.serialization.DescriptorTable
import org.jetbrains.kotlin.backend.common.serialization.isExpectMember
import org.jetbrains.kotlin.backend.common.serialization.isSerializableExpectClass
import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataSerializer
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.CallableDescriptor
@@ -26,8 +24,10 @@ import org.jetbrains.kotlin.serialization.DescriptorSerializer
class KlibMetadataIncrementalSerializer(
languageVersionSettings: LanguageVersionSettings,
metadataVersion: BinaryVersion,
descriptorTable: DescriptorTable
) : KlibMetadataSerializer(languageVersionSettings, metadataVersion, descriptorTable) {
moduleDescriptor: ModuleDescriptor,
descriptorTable: DescriptorTable,
skipExpects: Boolean
) : KlibMetadataSerializer(languageVersionSettings, metadataVersion, moduleDescriptor, descriptorTable, skipExpects) {
fun serializePackageFragment(
module: ModuleDescriptor,
@@ -41,13 +41,11 @@ class KlibMetadataIncrementalSerializer(
val classifierDescriptors = allDescriptors
.filterIsInstance<ClassifierDescriptor>()
.filter { !it.isExpectMember || it.isSerializableExpectClass }
.sortedBy { it.fqNameSafe.asString() }
val topLevelDescriptors = DescriptorSerializer.sort(
allDescriptors
.filterIsInstance<CallableDescriptor>()
.filter { !it.isExpectMember }
)
// TODO: For now, in the incremental serializer, we assume
@@ -19,8 +19,10 @@ import org.jetbrains.kotlin.serialization.DescriptorSerializer
class KlibMetadataMonolithicSerializer(
languageVersionSettings: LanguageVersionSettings,
metadataVersion: BinaryVersion,
descriptorTable: DescriptorTable
) : KlibMetadataSerializer(languageVersionSettings, metadataVersion, descriptorTable) {
moduleDescriptor: ModuleDescriptor,
descriptorTable: DescriptorTable,
skipExpects: Boolean
) : KlibMetadataSerializer(languageVersionSettings, metadataVersion, moduleDescriptor, descriptorTable, skipExpects) {
private fun serializePackageFragment(fqName: FqName, module: ModuleDescriptor): List<ProtoBuf.PackageFragment> {
@@ -33,13 +35,13 @@ class KlibMetadataMonolithicSerializer(
val classifierDescriptors = DescriptorSerializer.sort(
fragments.flatMap {
it.getMemberScope().getDescriptorsFiltered(DescriptorKindFilter.CLASSIFIERS)
}.filter { !it.isExpectMember || it.isSerializableExpectClass }
}
)
val topLevelDescriptors = DescriptorSerializer.sort(
fragments.flatMap { fragment ->
fragment.getMemberScope().getDescriptorsFiltered(DescriptorKindFilter.CALLABLES)
}.filter { !it.isExpectMember }
}
)
return serializeDescriptors(fqName, classifierDescriptors, topLevelDescriptors)
@@ -6,6 +6,8 @@
package org.jetbrains.kotlin.backend.common.serialization.metadata
import org.jetbrains.kotlin.backend.common.serialization.DescriptorTable
import org.jetbrains.kotlin.backend.common.serialization.isExpectMember
import org.jetbrains.kotlin.backend.common.serialization.isSerializableExpectClass
import org.jetbrains.kotlin.backend.common.serialization.newDescriptorUniqId
import org.jetbrains.kotlin.config.AnalysisFlags
import org.jetbrains.kotlin.config.LanguageVersionSettings
@@ -14,7 +16,10 @@ import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
import org.jetbrains.kotlin.serialization.DescriptorSerializer
import org.jetbrains.kotlin.serialization.StringTableImpl
@@ -28,7 +33,9 @@ internal fun <T, R> Iterable<T>.maybeChunked(size: Int?, transform: (List<T>) ->
abstract class KlibMetadataSerializer(
val languageVersionSettings: LanguageVersionSettings,
val metadataVersion: BinaryVersion,
val descriptorTable: DescriptorTable
val moduleDescriptor: ModuleDescriptor,
val descriptorTable: DescriptorTable,
val skipExpects: Boolean = false
) {
lateinit var serializerContext: SerializerContext
@@ -109,12 +116,30 @@ abstract class KlibMetadataSerializer(
}
}
protected fun serializeClasses(packageName: FqName,
// TODO: we filter out expects with present actuals.
// This is done because deserialized member scope doesn't give us actuals
// when it has a choice
private fun List<DeclarationDescriptor>.filterOutExpectsWithActuals(): List<DeclarationDescriptor> {
val actualClassIds = this.filter{ !it.isExpectMember }.map { ClassId.topLevel(it.fqNameSafe) }
return this.filterNot {
// TODO: this only filters classes for now.
// Need to do the same for functions etc
(it is ClassDescriptor) && it.isExpect() && ClassId.topLevel(it.fqNameSafe) in actualClassIds
}
}
protected fun List<DeclarationDescriptor>.filterOutExpects(): List<DeclarationDescriptor> =
if (skipExpects)
this.filterNot { it.isExpectMember && !it.isSerializableExpectClass }
else
this.filterOutExpectsWithActuals()
private fun serializeClasses(packageName: FqName,
//builder: ProtoBuf.PackageFragment.Builder,
descriptors: Collection<DeclarationDescriptor>): List<Pair<ProtoBuf.Class, Int>> {
return descriptors.filterIsInstance<ClassDescriptor>().flatMap {
serializeClass(packageName, /*builder, */it)
serializeClass(packageName, it)
}
}
@@ -131,6 +156,9 @@ abstract class KlibMetadataSerializer(
topLevelDescriptors: List<DeclarationDescriptor>
): List<ProtoBuf.PackageFragment> {
val classifierDescriptors = classifierDescriptors.filterOutExpects()
val topLevelDescriptors = topLevelDescriptors.filterOutExpects()
if (TOP_LEVEL_CLASS_DECLARATION_COUNT_PER_FILE == null &&
TOP_LEVEL_DECLARATION_COUNT_PER_FILE == null) {
@@ -0,0 +1,428 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.Actual}
*/
public final class Actual extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.Actual)
ActualOrBuilder {
// Use Actual.newBuilder() to construct.
private Actual(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private Actual(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private static final Actual defaultInstance;
public static Actual getDefaultInstance() {
return defaultInstance;
}
public Actual getDefaultInstanceForType() {
return defaultInstance;
}
private final org.jetbrains.kotlin.protobuf.ByteString unknownFields;
private Actual(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
org.jetbrains.kotlin.protobuf.ByteString.Output unknownFieldsOutput =
org.jetbrains.kotlin.protobuf.ByteString.newOutput();
org.jetbrains.kotlin.protobuf.CodedOutputStream unknownFieldsCodedOutput =
org.jetbrains.kotlin.protobuf.CodedOutputStream.newInstance(
unknownFieldsOutput, 1);
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFieldsCodedOutput,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 8: {
bitField0_ |= 0x00000001;
actualSymbol_ = input.readInt32();
break;
}
case 16: {
bitField0_ |= 0x00000002;
expectSymbol_ = input.readInt32();
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
try {
unknownFieldsCodedOutput.flush();
} catch (java.io.IOException e) {
// Should not happen
} finally {
unknownFields = unknownFieldsOutput.toByteString();
}
makeExtensionsImmutable();
}
}
public static org.jetbrains.kotlin.protobuf.Parser<Actual> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<Actual>() {
public Actual parsePartialFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new Actual(input, extensionRegistry);
}
};
@java.lang.Override
public org.jetbrains.kotlin.protobuf.Parser<Actual> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int ACTUAL_SYMBOL_FIELD_NUMBER = 1;
private int actualSymbol_;
/**
* <code>required int32 actual_symbol = 1;</code>
*/
public boolean hasActualSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 actual_symbol = 1;</code>
*/
public int getActualSymbol() {
return actualSymbol_;
}
public static final int EXPECT_SYMBOL_FIELD_NUMBER = 2;
private int expectSymbol_;
/**
* <code>required int32 expect_symbol = 2;</code>
*/
public boolean hasExpectSymbol() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 expect_symbol = 2;</code>
*/
public int getExpectSymbol() {
return expectSymbol_;
}
private void initFields() {
actualSymbol_ = 0;
expectSymbol_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasActualSymbol()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasExpectSymbol()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt32(1, actualSymbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, expectSymbol_);
}
output.writeRawBytes(unknownFields);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(1, actualSymbol_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(2, expectSymbol_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom(byte[] data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom(
byte[] data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseDelimitedFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.Actual parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.Actual prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.Actual}
*/
public static final class Builder extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder<
org.jetbrains.kotlin.backend.common.serialization.proto.Actual, Builder>
implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.Actual)
org.jetbrains.kotlin.backend.common.serialization.proto.ActualOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.Actual.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
actualSymbol_ = 0;
bitField0_ = (bitField0_ & ~0x00000001);
expectSymbol_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public org.jetbrains.kotlin.backend.common.serialization.proto.Actual getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.Actual.getDefaultInstance();
}
public org.jetbrains.kotlin.backend.common.serialization.proto.Actual build() {
org.jetbrains.kotlin.backend.common.serialization.proto.Actual result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.jetbrains.kotlin.backend.common.serialization.proto.Actual buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.Actual result = new org.jetbrains.kotlin.backend.common.serialization.proto.Actual(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.actualSymbol_ = actualSymbol_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.expectSymbol_ = expectSymbol_;
result.bitField0_ = to_bitField0_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.Actual other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.Actual.getDefaultInstance()) return this;
if (other.hasActualSymbol()) {
setActualSymbol(other.getActualSymbol());
}
if (other.hasExpectSymbol()) {
setExpectSymbol(other.getExpectSymbol());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
}
public final boolean isInitialized() {
if (!hasActualSymbol()) {
return false;
}
if (!hasExpectSymbol()) {
return false;
}
return true;
}
public Builder mergeFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.jetbrains.kotlin.backend.common.serialization.proto.Actual parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.Actual) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private int actualSymbol_ ;
/**
* <code>required int32 actual_symbol = 1;</code>
*/
public boolean hasActualSymbol() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 actual_symbol = 1;</code>
*/
public int getActualSymbol() {
return actualSymbol_;
}
/**
* <code>required int32 actual_symbol = 1;</code>
*/
public Builder setActualSymbol(int value) {
bitField0_ |= 0x00000001;
actualSymbol_ = value;
return this;
}
/**
* <code>required int32 actual_symbol = 1;</code>
*/
public Builder clearActualSymbol() {
bitField0_ = (bitField0_ & ~0x00000001);
actualSymbol_ = 0;
return this;
}
private int expectSymbol_ ;
/**
* <code>required int32 expect_symbol = 2;</code>
*/
public boolean hasExpectSymbol() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 expect_symbol = 2;</code>
*/
public int getExpectSymbol() {
return expectSymbol_;
}
/**
* <code>required int32 expect_symbol = 2;</code>
*/
public Builder setExpectSymbol(int value) {
bitField0_ |= 0x00000002;
expectSymbol_ = value;
return this;
}
/**
* <code>required int32 expect_symbol = 2;</code>
*/
public Builder clearExpectSymbol() {
bitField0_ = (bitField0_ & ~0x00000002);
expectSymbol_ = 0;
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.Actual)
}
static {
defaultInstance = new Actual(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.Actual)
}
@@ -0,0 +1,27 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
public interface ActualOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.Actual)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 actual_symbol = 1;</code>
*/
boolean hasActualSymbol();
/**
* <code>required int32 actual_symbol = 1;</code>
*/
int getActualSymbol();
/**
* <code>required int32 expect_symbol = 2;</code>
*/
boolean hasExpectSymbol();
/**
* <code>required int32 expect_symbol = 2;</code>
*/
int getExpectSymbol();
}
@@ -0,0 +1,479 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable}
*/
public final class ExpectActualTable extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable)
ExpectActualTableOrBuilder {
// Use ExpectActualTable.newBuilder() to construct.
private ExpectActualTable(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private ExpectActualTable(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private static final ExpectActualTable defaultInstance;
public static ExpectActualTable getDefaultInstance() {
return defaultInstance;
}
public ExpectActualTable getDefaultInstanceForType() {
return defaultInstance;
}
private final org.jetbrains.kotlin.protobuf.ByteString unknownFields;
private ExpectActualTable(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
org.jetbrains.kotlin.protobuf.ByteString.Output unknownFieldsOutput =
org.jetbrains.kotlin.protobuf.ByteString.newOutput();
org.jetbrains.kotlin.protobuf.CodedOutputStream unknownFieldsCodedOutput =
org.jetbrains.kotlin.protobuf.CodedOutputStream.newInstance(
unknownFieldsOutput, 1);
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFieldsCodedOutput,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
expectToActuals_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual>();
mutable_bitField0_ |= 0x00000001;
}
expectToActuals_.add(input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual.PARSER, extensionRegistry));
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
expectToActuals_ = java.util.Collections.unmodifiableList(expectToActuals_);
}
try {
unknownFieldsCodedOutput.flush();
} catch (java.io.IOException e) {
// Should not happen
} finally {
unknownFields = unknownFieldsOutput.toByteString();
}
makeExtensionsImmutable();
}
}
public static org.jetbrains.kotlin.protobuf.Parser<ExpectActualTable> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<ExpectActualTable>() {
public ExpectActualTable parsePartialFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new ExpectActualTable(input, extensionRegistry);
}
};
@java.lang.Override
public org.jetbrains.kotlin.protobuf.Parser<ExpectActualTable> getParserForType() {
return PARSER;
}
public static final int EXPECTTOACTUALS_FIELD_NUMBER = 1;
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual> expectToActuals_;
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual> getExpectToActualsList() {
return expectToActuals_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public java.util.List<? extends org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActualOrBuilder>
getExpectToActualsOrBuilderList() {
return expectToActuals_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public int getExpectToActualsCount() {
return expectToActuals_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual getExpectToActuals(int index) {
return expectToActuals_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActualOrBuilder getExpectToActualsOrBuilder(
int index) {
return expectToActuals_.get(index);
}
private void initFields() {
expectToActuals_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
for (int i = 0; i < getExpectToActualsCount(); i++) {
if (!getExpectToActuals(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < expectToActuals_.size(); i++) {
output.writeMessage(1, expectToActuals_.get(i));
}
output.writeRawBytes(unknownFields);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < expectToActuals_.size(); i++) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(1, expectToActuals_.get(i));
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable parseFrom(byte[] data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable parseFrom(
byte[] data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable parseFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable parseDelimitedFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable}
*/
public static final class Builder extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder<
org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable, Builder>
implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable)
org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTableOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
expectToActuals_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable.getDefaultInstance();
}
public org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable build() {
org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable result = new org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable(this);
int from_bitField0_ = bitField0_;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
expectToActuals_ = java.util.Collections.unmodifiableList(expectToActuals_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.expectToActuals_ = expectToActuals_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable.getDefaultInstance()) return this;
if (!other.expectToActuals_.isEmpty()) {
if (expectToActuals_.isEmpty()) {
expectToActuals_ = other.expectToActuals_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureExpectToActualsIsMutable();
expectToActuals_.addAll(other.expectToActuals_);
}
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
}
public final boolean isInitialized() {
for (int i = 0; i < getExpectToActualsCount(); i++) {
if (!getExpectToActuals(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual> expectToActuals_ =
java.util.Collections.emptyList();
private void ensureExpectToActualsIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
expectToActuals_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual>(expectToActuals_);
bitField0_ |= 0x00000001;
}
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual> getExpectToActualsList() {
return java.util.Collections.unmodifiableList(expectToActuals_);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public int getExpectToActualsCount() {
return expectToActuals_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual getExpectToActuals(int index) {
return expectToActuals_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public Builder setExpectToActuals(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual value) {
if (value == null) {
throw new NullPointerException();
}
ensureExpectToActualsIsMutable();
expectToActuals_.set(index, value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public Builder setExpectToActuals(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual.Builder builderForValue) {
ensureExpectToActualsIsMutable();
expectToActuals_.set(index, builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public Builder addExpectToActuals(org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual value) {
if (value == null) {
throw new NullPointerException();
}
ensureExpectToActualsIsMutable();
expectToActuals_.add(value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public Builder addExpectToActuals(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual value) {
if (value == null) {
throw new NullPointerException();
}
ensureExpectToActualsIsMutable();
expectToActuals_.add(index, value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public Builder addExpectToActuals(
org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual.Builder builderForValue) {
ensureExpectToActualsIsMutable();
expectToActuals_.add(builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public Builder addExpectToActuals(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual.Builder builderForValue) {
ensureExpectToActualsIsMutable();
expectToActuals_.add(index, builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public Builder addAllExpectToActuals(
java.lang.Iterable<? extends org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual> values) {
ensureExpectToActualsIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, expectToActuals_);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public Builder clearExpectToActuals() {
expectToActuals_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
public Builder removeExpectToActuals(int index) {
ensureExpectToActualsIsMutable();
expectToActuals_.remove(index);
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable)
}
static {
defaultInstance = new ExpectActualTable(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable)
}
@@ -0,0 +1,23 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
public interface ExpectActualTableOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.ExpectActualTable)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual>
getExpectToActualsList();
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual getExpectToActuals(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual expectToActuals = 1;</code>
*/
int getExpectToActualsCount();
}
@@ -0,0 +1,420 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual}
*/
public final class ExpectToActual extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual)
ExpectToActualOrBuilder {
// Use ExpectToActual.newBuilder() to construct.
private ExpectToActual(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private ExpectToActual(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private static final ExpectToActual defaultInstance;
public static ExpectToActual getDefaultInstance() {
return defaultInstance;
}
public ExpectToActual getDefaultInstanceForType() {
return defaultInstance;
}
private final org.jetbrains.kotlin.protobuf.ByteString unknownFields;
private ExpectToActual(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
org.jetbrains.kotlin.protobuf.ByteString.Output unknownFieldsOutput =
org.jetbrains.kotlin.protobuf.ByteString.newOutput();
org.jetbrains.kotlin.protobuf.CodedOutputStream unknownFieldsCodedOutput =
org.jetbrains.kotlin.protobuf.CodedOutputStream.newInstance(
unknownFieldsOutput, 1);
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFieldsCodedOutput,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 8: {
bitField0_ |= 0x00000001;
expect_ = input.readInt64();
break;
}
case 16: {
bitField0_ |= 0x00000002;
actual_ = input.readInt64();
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
try {
unknownFieldsCodedOutput.flush();
} catch (java.io.IOException e) {
// Should not happen
} finally {
unknownFields = unknownFieldsOutput.toByteString();
}
makeExtensionsImmutable();
}
}
public static org.jetbrains.kotlin.protobuf.Parser<ExpectToActual> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<ExpectToActual>() {
public ExpectToActual parsePartialFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new ExpectToActual(input, extensionRegistry);
}
};
@java.lang.Override
public org.jetbrains.kotlin.protobuf.Parser<ExpectToActual> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int EXPECT_FIELD_NUMBER = 1;
private long expect_;
/**
* <code>required int64 expect = 1;</code>
*/
public boolean hasExpect() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int64 expect = 1;</code>
*/
public long getExpect() {
return expect_;
}
public static final int ACTUAL_FIELD_NUMBER = 2;
private long actual_;
/**
* <code>optional int64 actual = 2;</code>
*/
public boolean hasActual() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional int64 actual = 2;</code>
*/
public long getActual() {
return actual_;
}
private void initFields() {
expect_ = 0L;
actual_ = 0L;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasExpect()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt64(1, expect_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt64(2, actual_);
}
output.writeRawBytes(unknownFields);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt64Size(1, expect_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt64Size(2, actual_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual parseFrom(byte[] data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual parseFrom(
byte[] data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual parseFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual parseDelimitedFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual}
*/
public static final class Builder extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder<
org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual, Builder>
implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual)
org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActualOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
expect_ = 0L;
bitField0_ = (bitField0_ & ~0x00000001);
actual_ = 0L;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual.getDefaultInstance();
}
public org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual build() {
org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual result = new org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.expect_ = expect_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.actual_ = actual_;
result.bitField0_ = to_bitField0_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual.getDefaultInstance()) return this;
if (other.hasExpect()) {
setExpect(other.getExpect());
}
if (other.hasActual()) {
setActual(other.getActual());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
}
public final boolean isInitialized() {
if (!hasExpect()) {
return false;
}
return true;
}
public Builder mergeFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private long expect_ ;
/**
* <code>required int64 expect = 1;</code>
*/
public boolean hasExpect() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int64 expect = 1;</code>
*/
public long getExpect() {
return expect_;
}
/**
* <code>required int64 expect = 1;</code>
*/
public Builder setExpect(long value) {
bitField0_ |= 0x00000001;
expect_ = value;
return this;
}
/**
* <code>required int64 expect = 1;</code>
*/
public Builder clearExpect() {
bitField0_ = (bitField0_ & ~0x00000001);
expect_ = 0L;
return this;
}
private long actual_ ;
/**
* <code>optional int64 actual = 2;</code>
*/
public boolean hasActual() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional int64 actual = 2;</code>
*/
public long getActual() {
return actual_;
}
/**
* <code>optional int64 actual = 2;</code>
*/
public Builder setActual(long value) {
bitField0_ |= 0x00000002;
actual_ = value;
return this;
}
/**
* <code>optional int64 actual = 2;</code>
*/
public Builder clearActual() {
bitField0_ = (bitField0_ & ~0x00000002);
actual_ = 0L;
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual)
}
static {
defaultInstance = new ExpectToActual(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual)
}
@@ -0,0 +1,27 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
public interface ExpectToActualOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.ExpectToActual)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int64 expect = 1;</code>
*/
boolean hasExpect();
/**
* <code>required int64 expect = 1;</code>
*/
long getExpect();
/**
* <code>optional int64 actual = 2;</code>
*/
boolean hasActual();
/**
* <code>optional int64 actual = 2;</code>
*/
long getActual();
}
@@ -137,6 +137,14 @@ public final class IrFile extends
input.popLimit(limit);
break;
}
case 50: {
if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
actuals_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.Actual>();
mutable_bitField0_ |= 0x00000020;
}
actuals_.add(input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.Actual.PARSER, extensionRegistry));
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -157,6 +165,9 @@ public final class IrFile extends
if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
explicitlyExportedToCompiler_ = java.util.Collections.unmodifiableList(explicitlyExportedToCompiler_);
}
if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
actuals_ = java.util.Collections.unmodifiableList(actuals_);
}
try {
unknownFieldsCodedOutput.flush();
} catch (java.io.IOException e) {
@@ -299,12 +310,48 @@ public final class IrFile extends
return explicitlyExportedToCompiler_.get(index);
}
public static final int ACTUALS_FIELD_NUMBER = 6;
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.Actual> actuals_;
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.Actual> getActualsList() {
return actuals_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public java.util.List<? extends org.jetbrains.kotlin.backend.common.serialization.proto.ActualOrBuilder>
getActualsOrBuilderList() {
return actuals_;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public int getActualsCount() {
return actuals_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.Actual getActuals(int index) {
return actuals_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.ActualOrBuilder getActualsOrBuilder(
int index) {
return actuals_.get(index);
}
private void initFields() {
declarationId_ = java.util.Collections.emptyList();
fileEntry_ = org.jetbrains.kotlin.backend.common.serialization.proto.FileEntry.getDefaultInstance();
fqName_ = java.util.Collections.emptyList();
annotation_ = java.util.Collections.emptyList();
explicitlyExportedToCompiler_ = java.util.Collections.emptyList();
actuals_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -326,6 +373,12 @@ public final class IrFile extends
return false;
}
}
for (int i = 0; i < getActualsCount(); i++) {
if (!getActuals(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
@@ -348,6 +401,9 @@ public final class IrFile extends
for (int i = 0; i < explicitlyExportedToCompiler_.size(); i++) {
output.writeInt32(5, explicitlyExportedToCompiler_.get(i));
}
for (int i = 0; i < actuals_.size(); i++) {
output.writeMessage(6, actuals_.get(i));
}
output.writeRawBytes(unknownFields);
}
@@ -392,6 +448,10 @@ public final class IrFile extends
size += dataSize;
size += 1 * getExplicitlyExportedToCompilerList().size();
}
for (int i = 0; i < actuals_.size(); i++) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(6, actuals_.get(i));
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
@@ -496,6 +556,8 @@ public final class IrFile extends
bitField0_ = (bitField0_ & ~0x00000008);
explicitlyExportedToCompiler_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000010);
actuals_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000020);
return this;
}
@@ -543,6 +605,11 @@ public final class IrFile extends
bitField0_ = (bitField0_ & ~0x00000010);
}
result.explicitlyExportedToCompiler_ = explicitlyExportedToCompiler_;
if (((bitField0_ & 0x00000020) == 0x00000020)) {
actuals_ = java.util.Collections.unmodifiableList(actuals_);
bitField0_ = (bitField0_ & ~0x00000020);
}
result.actuals_ = actuals_;
result.bitField0_ = to_bitField0_;
return result;
}
@@ -591,6 +658,16 @@ public final class IrFile extends
explicitlyExportedToCompiler_.addAll(other.explicitlyExportedToCompiler_);
}
}
if (!other.actuals_.isEmpty()) {
if (actuals_.isEmpty()) {
actuals_ = other.actuals_;
bitField0_ = (bitField0_ & ~0x00000020);
} else {
ensureActualsIsMutable();
actuals_.addAll(other.actuals_);
}
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
@@ -612,6 +689,12 @@ public final class IrFile extends
return false;
}
}
for (int i = 0; i < getActualsCount(); i++) {
if (!getActuals(i).isInitialized()) {
return false;
}
}
return true;
}
@@ -1017,6 +1100,131 @@ public final class IrFile extends
return this;
}
private java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.Actual> actuals_ =
java.util.Collections.emptyList();
private void ensureActualsIsMutable() {
if (!((bitField0_ & 0x00000020) == 0x00000020)) {
actuals_ = new java.util.ArrayList<org.jetbrains.kotlin.backend.common.serialization.proto.Actual>(actuals_);
bitField0_ |= 0x00000020;
}
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.Actual> getActualsList() {
return java.util.Collections.unmodifiableList(actuals_);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public int getActualsCount() {
return actuals_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.Actual getActuals(int index) {
return actuals_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public Builder setActuals(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.Actual value) {
if (value == null) {
throw new NullPointerException();
}
ensureActualsIsMutable();
actuals_.set(index, value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public Builder setActuals(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.Actual.Builder builderForValue) {
ensureActualsIsMutable();
actuals_.set(index, builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public Builder addActuals(org.jetbrains.kotlin.backend.common.serialization.proto.Actual value) {
if (value == null) {
throw new NullPointerException();
}
ensureActualsIsMutable();
actuals_.add(value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public Builder addActuals(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.Actual value) {
if (value == null) {
throw new NullPointerException();
}
ensureActualsIsMutable();
actuals_.add(index, value);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public Builder addActuals(
org.jetbrains.kotlin.backend.common.serialization.proto.Actual.Builder builderForValue) {
ensureActualsIsMutable();
actuals_.add(builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public Builder addActuals(
int index, org.jetbrains.kotlin.backend.common.serialization.proto.Actual.Builder builderForValue) {
ensureActualsIsMutable();
actuals_.add(index, builderForValue.build());
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public Builder addAllActuals(
java.lang.Iterable<? extends org.jetbrains.kotlin.backend.common.serialization.proto.Actual> values) {
ensureActualsIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, actuals_);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public Builder clearActuals() {
actuals_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000020);
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
public Builder removeActuals(int index) {
ensureActualsIsMutable();
actuals_.remove(index);
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrFile)
}
@@ -68,4 +68,18 @@ public interface IrFileOrBuilder extends
* <code>repeated int32 explicitly_exported_to_compiler = 5;</code>
*/
int getExplicitlyExportedToCompiler(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
java.util.List<org.jetbrains.kotlin.backend.common.serialization.proto.Actual>
getActualsList();
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.Actual getActuals(int index);
/**
* <code>repeated .org.jetbrains.kotlin.backend.common.serialization.proto.Actual actuals = 6;</code>
*/
int getActualsCount();
}