IR: add IrClass.getInlineClassRepresentation, serialize/deserialize it

The change in FirDeclarationUtil is needed because in case of unsigned
types loaded from the standard library, the primary constructor for some
reason is not the first, but the second in the list of constructors.
This commit is contained in:
Alexander Udalov
2021-03-30 18:16:37 +02:00
parent 4c7f207309
commit 54befa769f
33 changed files with 950 additions and 59 deletions
@@ -507,6 +507,7 @@ message IrClass {
repeated IrTypeParameter type_parameter = 4;
repeated IrDeclaration declaration = 5;
repeated int32 super_type = 6 [packed=true];
optional IrInlineClassRepresentation inline_class_representation = 7;
}
message IrTypeAlias {
@@ -590,7 +591,12 @@ message IrStatement {
}
}
message IrInlineClassRepresentation {
required int32 underlying_property_name = 1;
required int32 underlying_property_type = 2;
}
message PirBodyCarrier {
required int32 lastModified = 1;
optional int64 containerFieldSymbol = 2;
}
}
@@ -25,7 +25,8 @@ message PirClassCarrier {
optional int64 thisReceiver = 5;
repeated int64 typeParameters = 6;
repeated int32 superTypes = 7;
optional int64 flags = 8 [default = 0];
optional IrInlineClassRepresentation inlineClassRepresentation = 8;
optional int64 flags = 9 [default = 0];
}
message PirConstructorCarrier {
@@ -11,18 +11,24 @@ import org.jetbrains.kotlin.backend.common.overrides.FakeOverrideClassFilter
import org.jetbrains.kotlin.backend.common.serialization.encodings.*
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration.DeclaratorCase.*
import org.jetbrains.kotlin.backend.common.serialization.proto.IrType.KindCase.*
import org.jetbrains.kotlin.descriptors.InlineClassRepresentation
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl
import org.jetbrains.kotlin.ir.descriptors.*
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
import org.jetbrains.kotlin.ir.expressions.IrBody
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.expressions.impl.IrErrorExpressionImpl
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.symbols.impl.IrPublicSymbolBase
import org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.*
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.ir.util.IdSignature
import org.jetbrains.kotlin.ir.util.SymbolTable
import org.jetbrains.kotlin.ir.util.withScope
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.protobuf.CodedInputStream
import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite
@@ -35,16 +41,17 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration as
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase as ProtoDeclarationBase
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDynamicType as ProtoDynamicType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry as ProtoEnumEntry
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorDeclaration as ProtoErrorDeclaration
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorType as ProtoErrorType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrExpression as ProtoExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrField as ProtoField
import org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction as ProtoFunction
import org.jetbrains.kotlin.backend.common.serialization.proto.IrFunctionBase as ProtoFunctionBase
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorDeclaration as ProtoErrorDeclaration
import org.jetbrains.kotlin.backend.common.serialization.proto.IrExpression as ProtoExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement as ProtoStatement
import org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation as ProtoIrInlineClassRepresentation
import org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty as ProtoLocalDelegatedProperty
import org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty as ProtoProperty
import org.jetbrains.kotlin.backend.common.serialization.proto.IrSimpleType as ProtoSimpleType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrStatement as ProtoStatement
import org.jetbrains.kotlin.backend.common.serialization.proto.IrType as ProtoType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAbbreviation as ProtoTypeAbbreviation
import org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias as ProtoTypeAlias
@@ -319,11 +326,21 @@ class IrDeclarationDeserializer(
thisReceiver = deserializeIrValueParameter(proto.thisReceiver, -1)
inlineClassRepresentation =
if (proto.hasInlineClassRepresentation()) deserializeInlineClassRepresentation(proto.inlineClassRepresentation)
else null
fakeOverrideBuilder.enqueueClass(this, signature)
}
}
}
fun deserializeInlineClassRepresentation(proto: ProtoIrInlineClassRepresentation): InlineClassRepresentation<IrSimpleType> =
InlineClassRepresentation(
deserializeName(proto.underlyingPropertyName),
deserializeIrType(proto.underlyingPropertyType) as IrSimpleType,
)
private fun deserializeIrTypeAlias(proto: ProtoTypeAlias): IrTypeAlias =
withDeserializedIrDeclarationBase(proto.base) { symbol, uniqId, startOffset, endOffset, origin, fcode ->
require(symbol is IrTypeAliasSymbol)
@@ -721,4 +738,4 @@ class IrDeclarationDeserializer(
else -> false
}
}
}
}
@@ -8,8 +8,8 @@ package org.jetbrains.kotlin.backend.common.serialization
import org.jetbrains.kotlin.backend.common.ir.ir2string
import org.jetbrains.kotlin.backend.common.serialization.encodings.*
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.IrFileEntry
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.IrFileEntry
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.symbols.*
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.library.impl.IrMemoryDeclarationWriter
import org.jetbrains.kotlin.library.impl.IrMemoryStringWriter
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature as ProtoAccessorIdSignature
import org.jetbrains.kotlin.backend.common.serialization.proto.Actual as ProtoActual
import org.jetbrains.kotlin.backend.common.serialization.proto.FieldAccessCommon as ProtoFieldAccessCommon
import org.jetbrains.kotlin.backend.common.serialization.proto.FileEntry as ProtoFileEntry
@@ -52,9 +53,9 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrDynamicOperator
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDynamicType as ProtoDynamicType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumConstructorCall as ProtoEnumConstructorCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry as ProtoEnumEntry
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorCallExpression as ProtoErrorCallExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorDeclaration as ProtoErrorDeclaration
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorExpression as ProtoErrorExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorCallExpression as ProtoErrorCallExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrErrorType as ProtoErrorType
import org.jetbrains.kotlin.backend.common.serialization.proto.IrExpression as ProtoExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.IrField as ProtoField
@@ -68,6 +69,7 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.IrGetEnumValue as
import org.jetbrains.kotlin.backend.common.serialization.proto.IrGetField as ProtoGetField
import org.jetbrains.kotlin.backend.common.serialization.proto.IrGetObject as ProtoGetObject
import org.jetbrains.kotlin.backend.common.serialization.proto.IrGetValue as ProtoGetValue
import org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation as ProtoIrInlineClassRepresentation
import org.jetbrains.kotlin.backend.common.serialization.proto.IrInstanceInitializerCall as ProtoInstanceInitializerCall
import org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty as ProtoLocalDelegatedProperty
import org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedPropertyReference as ProtoLocalDelegatedPropertyReference
@@ -101,7 +103,6 @@ import org.jetbrains.kotlin.backend.common.serialization.proto.Loop as ProtoLoop
import org.jetbrains.kotlin.backend.common.serialization.proto.MemberAccessCommon as ProtoMemberAccessCommon
import org.jetbrains.kotlin.backend.common.serialization.proto.NullableIrExpression as ProtoNullableIrExpression
import org.jetbrains.kotlin.backend.common.serialization.proto.PublicIdSignature as ProtoPublicIdSignature
import org.jetbrains.kotlin.backend.common.serialization.proto.AccessorIdSignature as ProtoAccessorIdSignature
open class IrFileSerializer(
val messageLogger: IrMessageLogger,
@@ -1149,6 +1150,11 @@ open class IrFileSerializer(
.setBase(serializeIrDeclarationBase(clazz, ClassFlags.encode(clazz)))
.setName(serializeName(clazz.name))
val representation = clazz.inlineClassRepresentation
if (representation != null) {
proto.inlineClassRepresentation = serializeInlineClassRepresentation(representation)
}
if (!skipMutableState) {
clazz.declarations.forEach {
if (memberNeedsSerialization(it)) proto.addDeclaration(serializeDeclaration(it))
@@ -1168,6 +1174,13 @@ open class IrFileSerializer(
return proto.build()
}
fun serializeInlineClassRepresentation(representation: InlineClassRepresentation<IrSimpleType>): ProtoIrInlineClassRepresentation =
ProtoIrInlineClassRepresentation.newBuilder().apply {
underlyingPropertyName = serializeName(representation.underlyingPropertyName)
// TODO: consider not writing type if the property is public, similarly to metadata
underlyingPropertyType = serializeIrType(representation.underlyingType)
}.build()
private fun serializeIrTypeAlias(typeAlias: IrTypeAlias): ProtoTypeAlias {
val proto = ProtoTypeAlias.newBuilder()
@@ -1400,4 +1413,3 @@ open class IrFileSerializer(
}
}
}
@@ -121,6 +121,19 @@ public final class IrClass extends
input.popLimit(limit);
break;
}
case 58: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.Builder subBuilder = null;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
subBuilder = inlineClassRepresentation_.toBuilder();
}
inlineClassRepresentation_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(inlineClassRepresentation_);
inlineClassRepresentation_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000008;
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -302,6 +315,21 @@ public final class IrClass extends
}
private int superTypeMemoizedSerializedSize = -1;
public static final int INLINE_CLASS_REPRESENTATION_FIELD_NUMBER = 7;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public boolean hasInlineClassRepresentation() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getInlineClassRepresentation() {
return inlineClassRepresentation_;
}
private void initFields() {
base_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase.getDefaultInstance();
name_ = 0;
@@ -309,6 +337,7 @@ public final class IrClass extends
typeParameter_ = java.util.Collections.emptyList();
declaration_ = java.util.Collections.emptyList();
superType_ = java.util.Collections.emptyList();
inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -346,6 +375,12 @@ public final class IrClass extends
return false;
}
}
if (hasInlineClassRepresentation()) {
if (!getInlineClassRepresentation().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
@@ -375,6 +410,9 @@ public final class IrClass extends
for (int i = 0; i < superType_.size(); i++) {
output.writeInt32NoTag(superType_.get(i));
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeMessage(7, inlineClassRepresentation_);
}
output.writeRawBytes(unknownFields);
}
@@ -418,6 +456,10 @@ public final class IrClass extends
}
superTypeMemoizedSerializedSize = dataSize;
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(7, inlineClassRepresentation_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
@@ -524,6 +566,8 @@ public final class IrClass extends
bitField0_ = (bitField0_ & ~0x00000010);
superType_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000020);
inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000040);
return this;
}
@@ -574,6 +618,10 @@ public final class IrClass extends
bitField0_ = (bitField0_ & ~0x00000020);
}
result.superType_ = superType_;
if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
to_bitField0_ |= 0x00000008;
}
result.inlineClassRepresentation_ = inlineClassRepresentation_;
result.bitField0_ = to_bitField0_;
return result;
}
@@ -619,6 +667,9 @@ public final class IrClass extends
}
}
if (other.hasInlineClassRepresentation()) {
mergeInlineClassRepresentation(other.getInlineClassRepresentation());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
@@ -655,6 +706,12 @@ public final class IrClass extends
return false;
}
}
if (hasInlineClassRepresentation()) {
if (!getInlineClassRepresentation().isInitialized()) {
return false;
}
}
return true;
}
@@ -1145,6 +1202,66 @@ public final class IrClass extends
return this;
}
private org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public boolean hasInlineClassRepresentation() {
return ((bitField0_ & 0x00000040) == 0x00000040);
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getInlineClassRepresentation() {
return inlineClassRepresentation_;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public Builder setInlineClassRepresentation(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation value) {
if (value == null) {
throw new NullPointerException();
}
inlineClassRepresentation_ = value;
bitField0_ |= 0x00000040;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public Builder setInlineClassRepresentation(
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.Builder builderForValue) {
inlineClassRepresentation_ = builderForValue.build();
bitField0_ |= 0x00000040;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public Builder mergeInlineClassRepresentation(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation value) {
if (((bitField0_ & 0x00000040) == 0x00000040) &&
inlineClassRepresentation_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance()) {
inlineClassRepresentation_ =
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.newBuilder(inlineClassRepresentation_).mergeFrom(value).buildPartial();
} else {
inlineClassRepresentation_ = value;
}
bitField0_ |= 0x00000040;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
public Builder clearInlineClassRepresentation() {
inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000040);
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrClass)
}
@@ -74,4 +74,13 @@ public interface IrClassOrBuilder extends
* <code>repeated int32 super_type = 6 [packed = true];</code>
*/
int getSuperType(int index);
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
boolean hasInlineClassRepresentation();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inline_class_representation = 7;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getInlineClassRepresentation();
}
@@ -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.IrInlineClassRepresentation}
*/
public final class IrInlineClassRepresentation extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation)
IrInlineClassRepresentationOrBuilder {
// Use IrInlineClassRepresentation.newBuilder() to construct.
private IrInlineClassRepresentation(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private IrInlineClassRepresentation(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private static final IrInlineClassRepresentation defaultInstance;
public static IrInlineClassRepresentation getDefaultInstance() {
return defaultInstance;
}
public IrInlineClassRepresentation getDefaultInstanceForType() {
return defaultInstance;
}
private final org.jetbrains.kotlin.protobuf.ByteString unknownFields;
private IrInlineClassRepresentation(
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;
underlyingPropertyName_ = input.readInt32();
break;
}
case 16: {
bitField0_ |= 0x00000002;
underlyingPropertyType_ = 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<IrInlineClassRepresentation> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<IrInlineClassRepresentation>() {
public IrInlineClassRepresentation parsePartialFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new IrInlineClassRepresentation(input, extensionRegistry);
}
};
@java.lang.Override
public org.jetbrains.kotlin.protobuf.Parser<IrInlineClassRepresentation> getParserForType() {
return PARSER;
}
private int bitField0_;
public static final int UNDERLYING_PROPERTY_NAME_FIELD_NUMBER = 1;
private int underlyingPropertyName_;
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
public boolean hasUnderlyingPropertyName() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
public int getUnderlyingPropertyName() {
return underlyingPropertyName_;
}
public static final int UNDERLYING_PROPERTY_TYPE_FIELD_NUMBER = 2;
private int underlyingPropertyType_;
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
public boolean hasUnderlyingPropertyType() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
public int getUnderlyingPropertyType() {
return underlyingPropertyType_;
}
private void initFields() {
underlyingPropertyName_ = 0;
underlyingPropertyType_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasUnderlyingPropertyName()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasUnderlyingPropertyType()) {
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, underlyingPropertyName_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, underlyingPropertyType_);
}
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, underlyingPropertyName_);
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(2, underlyingPropertyType_);
}
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.IrInlineClassRepresentation 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.IrInlineClassRepresentation 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.IrInlineClassRepresentation parseFrom(byte[] data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation 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.IrInlineClassRepresentation parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation 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.IrInlineClassRepresentation parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation 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.IrInlineClassRepresentation parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation 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.IrInlineClassRepresentation prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation}
*/
public static final class Builder extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder<
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation, Builder>
implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation)
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentationOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
underlyingPropertyName_ = 0;
bitField0_ = (bitField0_ & ~0x00000001);
underlyingPropertyType_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation build() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation result = new org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.underlyingPropertyName_ = underlyingPropertyName_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.underlyingPropertyType_ = underlyingPropertyType_;
result.bitField0_ = to_bitField0_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance()) return this;
if (other.hasUnderlyingPropertyName()) {
setUnderlyingPropertyName(other.getUnderlyingPropertyName());
}
if (other.hasUnderlyingPropertyType()) {
setUnderlyingPropertyType(other.getUnderlyingPropertyType());
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
}
public final boolean isInitialized() {
if (!hasUnderlyingPropertyName()) {
return false;
}
if (!hasUnderlyingPropertyType()) {
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.IrInlineClassRepresentation parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private int underlyingPropertyName_ ;
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
public boolean hasUnderlyingPropertyName() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
public int getUnderlyingPropertyName() {
return underlyingPropertyName_;
}
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
public Builder setUnderlyingPropertyName(int value) {
bitField0_ |= 0x00000001;
underlyingPropertyName_ = value;
return this;
}
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
public Builder clearUnderlyingPropertyName() {
bitField0_ = (bitField0_ & ~0x00000001);
underlyingPropertyName_ = 0;
return this;
}
private int underlyingPropertyType_ ;
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
public boolean hasUnderlyingPropertyType() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
public int getUnderlyingPropertyType() {
return underlyingPropertyType_;
}
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
public Builder setUnderlyingPropertyType(int value) {
bitField0_ |= 0x00000002;
underlyingPropertyType_ = value;
return this;
}
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
public Builder clearUnderlyingPropertyType() {
bitField0_ = (bitField0_ & ~0x00000002);
underlyingPropertyType_ = 0;
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation)
}
static {
defaultInstance = new IrInlineClassRepresentation(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation)
}
@@ -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 IrInlineClassRepresentationOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
boolean hasUnderlyingPropertyName();
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
int getUnderlyingPropertyName();
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
boolean hasUnderlyingPropertyType();
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
int getUnderlyingPropertyType();
}
@@ -123,8 +123,21 @@ public final class PirClassCarrier extends
input.popLimit(limit);
break;
}
case 64: {
case 66: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.Builder subBuilder = null;
if (((bitField0_ & 0x00000010) == 0x00000010)) {
subBuilder = inlineClassRepresentation_.toBuilder();
}
inlineClassRepresentation_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(inlineClassRepresentation_);
inlineClassRepresentation_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000010;
break;
}
case 72: {
bitField0_ |= 0x00000020;
flags_ = input.readInt64();
break;
}
@@ -310,16 +323,31 @@ public final class PirClassCarrier extends
return superTypes_.get(index);
}
public static final int FLAGS_FIELD_NUMBER = 8;
private long flags_;
public static final int INLINECLASSREPRESENTATION_FIELD_NUMBER = 8;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation_;
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public boolean hasFlags() {
public boolean hasInlineClassRepresentation() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getInlineClassRepresentation() {
return inlineClassRepresentation_;
}
public static final int FLAGS_FIELD_NUMBER = 9;
private long flags_;
/**
* <code>optional int64 flags = 9 [default = 0];</code>
*/
public boolean hasFlags() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>optional int64 flags = 9 [default = 0];</code>
*/
public long getFlags() {
return flags_;
@@ -333,6 +361,7 @@ public final class PirClassCarrier extends
thisReceiver_ = 0L;
typeParameters_ = java.util.Collections.emptyList();
superTypes_ = java.util.Collections.emptyList();
inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
flags_ = 0L;
}
private byte memoizedIsInitialized = -1;
@@ -351,6 +380,12 @@ public final class PirClassCarrier extends
return false;
}
}
if (hasInlineClassRepresentation()) {
if (!getInlineClassRepresentation().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
@@ -380,7 +415,10 @@ public final class PirClassCarrier extends
output.writeInt32(7, superTypes_.get(i));
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeInt64(8, flags_);
output.writeMessage(8, inlineClassRepresentation_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeInt64(9, flags_);
}
output.writeRawBytes(unknownFields);
}
@@ -431,7 +469,11 @@ public final class PirClassCarrier extends
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt64Size(8, flags_);
.computeMessageSize(8, inlineClassRepresentation_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt64Size(9, flags_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -541,8 +583,10 @@ public final class PirClassCarrier extends
bitField0_ = (bitField0_ & ~0x00000020);
superTypes_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000040);
flags_ = 0L;
inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000080);
flags_ = 0L;
bitField0_ = (bitField0_ & ~0x00000100);
return this;
}
@@ -600,6 +644,10 @@ public final class PirClassCarrier extends
if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
to_bitField0_ |= 0x00000010;
}
result.inlineClassRepresentation_ = inlineClassRepresentation_;
if (((from_bitField0_ & 0x00000100) == 0x00000100)) {
to_bitField0_ |= 0x00000020;
}
result.flags_ = flags_;
result.bitField0_ = to_bitField0_;
return result;
@@ -649,6 +697,9 @@ public final class PirClassCarrier extends
}
}
if (other.hasInlineClassRepresentation()) {
mergeInlineClassRepresentation(other.getInlineClassRepresentation());
}
if (other.hasFlags()) {
setFlags(other.getFlags());
}
@@ -668,6 +719,12 @@ public final class PirClassCarrier extends
return false;
}
}
if (hasInlineClassRepresentation()) {
if (!getInlineClassRepresentation().isInitialized()) {
return false;
}
}
return true;
}
@@ -1075,33 +1132,93 @@ public final class PirClassCarrier extends
return this;
}
private long flags_ ;
private org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public boolean hasFlags() {
public boolean hasInlineClassRepresentation() {
return ((bitField0_ & 0x00000080) == 0x00000080);
}
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getInlineClassRepresentation() {
return inlineClassRepresentation_;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public Builder setInlineClassRepresentation(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation value) {
if (value == null) {
throw new NullPointerException();
}
inlineClassRepresentation_ = value;
bitField0_ |= 0x00000080;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public Builder setInlineClassRepresentation(
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.Builder builderForValue) {
inlineClassRepresentation_ = builderForValue.build();
bitField0_ |= 0x00000080;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public Builder mergeInlineClassRepresentation(org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation value) {
if (((bitField0_ & 0x00000080) == 0x00000080) &&
inlineClassRepresentation_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance()) {
inlineClassRepresentation_ =
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.newBuilder(inlineClassRepresentation_).mergeFrom(value).buildPartial();
} else {
inlineClassRepresentation_ = value;
}
bitField0_ |= 0x00000080;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
public Builder clearInlineClassRepresentation() {
inlineClassRepresentation_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000080);
return this;
}
private long flags_ ;
/**
* <code>optional int64 flags = 9 [default = 0];</code>
*/
public boolean hasFlags() {
return ((bitField0_ & 0x00000100) == 0x00000100);
}
/**
* <code>optional int64 flags = 9 [default = 0];</code>
*/
public long getFlags() {
return flags_;
}
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional int64 flags = 9 [default = 0];</code>
*/
public Builder setFlags(long value) {
bitField0_ |= 0x00000080;
bitField0_ |= 0x00000100;
flags_ = value;
return this;
}
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional int64 flags = 9 [default = 0];</code>
*/
public Builder clearFlags() {
bitField0_ = (bitField0_ & ~0x00000080);
bitField0_ = (bitField0_ & ~0x00000100);
flags_ = 0L;
return this;
@@ -84,11 +84,20 @@ public interface PirClassCarrierOrBuilder extends
int getSuperTypes(int index);
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
boolean hasInlineClassRepresentation();
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation inlineClassRepresentation = 8;</code>
*/
org.jetbrains.kotlin.backend.common.serialization.proto.IrInlineClassRepresentation getInlineClassRepresentation();
/**
* <code>optional int64 flags = 9 [default = 0];</code>
*/
boolean hasFlags();
/**
* <code>optional int64 flags = 8 [default = 0];</code>
* <code>optional int64 flags = 9 [default = 0];</code>
*/
long getFlags();
}
@@ -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 PirInlineClassRepresentationOrBuilder extends
// @@protoc_insertion_point(interface_extends:org.jetbrains.kotlin.backend.common.serialization.proto.PirInlineClassRepresentation)
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
boolean hasUnderlyingPropertyName();
/**
* <code>required int32 underlying_property_name = 1;</code>
*/
int getUnderlyingPropertyName();
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
boolean hasUnderlyingPropertyType();
/**
* <code>required int32 underlying_property_type = 2;</code>
*/
int getUnderlyingPropertyType();
}