Implement serialization of inner types

This commit is contained in:
Denis Zharkov
2015-11-11 14:36:31 +03:00
parent 8cb85759c7
commit 7500447e72
13 changed files with 720 additions and 90 deletions
@@ -471,7 +471,11 @@ public class DescriptorSerializer {
ClassifierDescriptor descriptor = type.getConstructor().getDeclarationDescriptor();
if (descriptor instanceof ClassDescriptor) {
builder.setClassName(getClassId((ClassDescriptor) descriptor));
PossiblyInnerType possiblyInnerType = TypeParameterUtilsKt.buildPossiblyInnerType(type);
assert possiblyInnerType != null : "possiblyInnerType should not be null in case of class";
fillFromPossiblyInnerType(builder, possiblyInnerType);
}
if (descriptor instanceof TypeParameterDescriptor) {
TypeParameterDescriptor typeParameter = (TypeParameterDescriptor) descriptor;
@@ -481,10 +485,8 @@ public class DescriptorSerializer {
else {
builder.setTypeParameter(getTypeParameterId(typeParameter));
}
}
for (TypeProjection projection : type.getArguments()) {
builder.addArgument(typeArgument(projection));
assert type.getArguments().isEmpty() : "Found arguments for type constructor build on type parameter: " + descriptor;
}
if (type.isMarkedNullable() != builder.getNullable()) {
@@ -496,6 +498,29 @@ public class DescriptorSerializer {
return builder;
}
private void fillFromPossiblyInnerType(
@NotNull ProtoBuf.Type.Builder builder,
@NotNull PossiblyInnerType type
) {
builder.setClassName(getClassId(type.getClassDescriptor()));
for (TypeProjection projection : type.getArguments()) {
builder.addArgument(typeArgument(projection));
}
if (type.getOuterType() != null) {
ProtoBuf.Type.Builder outerBuilder = ProtoBuf.Type.newBuilder();
fillFromPossiblyInnerType(outerBuilder, type.getOuterType());
if (useTypeTable()) {
builder.setOuterTypeId(typeTable.get(outerBuilder));
}
else {
builder.setOuterType(outerBuilder);
}
}
}
@NotNull
private ProtoBuf.Type.Argument.Builder typeArgument(@NotNull TypeProjection typeProjection) {
ProtoBuf.Type.Argument.Builder builder = ProtoBuf.Type.Argument.newBuilder();
@@ -0,0 +1,33 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test
class Outer<E, F> {
inner class Inner<G, H> {
inner class Inner3<I> {
fun foo(
x: Outer<String, F>.Inner<G, Int>,
y: Inner<E, Double>,
z: Outer<String, F>.Inner<G, Int>.Inner3<Double>,
w: Inner3<*>) {}
}
}
inner class Inner2
fun bar(x: Outer<String, Double>.Inner2, y: Inner2) {}
}
@@ -0,0 +1,19 @@
package test
public final class Outer</*0*/ E, /*1*/ F> {
/*primary*/ public constructor Outer</*0*/ E, /*1*/ F>()
public final fun bar(/*0*/ x: test.Outer<kotlin.String, kotlin.Double>.Inner2, /*1*/ y: test.Outer<E, F>.Inner2): kotlin.Unit
public final inner class Inner</*0*/ G, /*1*/ H> {
/*primary*/ public constructor Inner</*0*/ G, /*1*/ H>()
public final inner class Inner3</*0*/ I> {
/*primary*/ public constructor Inner3</*0*/ I>()
public final fun foo(/*0*/ x: test.Outer<kotlin.String, F>.Inner<G, kotlin.Int>, /*1*/ y: test.Outer<E, F>.Inner<E, kotlin.Double>, /*2*/ z: test.Outer<kotlin.String, F>.Inner<G, kotlin.Int>.Inner3<kotlin.Double>, /*3*/ w: test.Outer<E, F>.Inner<G, H>.Inner3<*>): kotlin.Unit
}
}
public final inner class Inner2 {
/*primary*/ public constructor Inner2()
}
}
@@ -2560,6 +2560,12 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
doTestCompiledKotlin(fileName);
}
@TestMetadata("InnerTypes.kt")
public void testInnerTypes() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/InnerTypes.kt");
doTestCompiledKotlin(fileName);
}
@TestMetadata("NamedObject.kt")
public void testNamedObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/NamedObject.kt");
@@ -649,6 +649,12 @@ public class LoadKotlinWithTypeTableTestGenerated extends AbstractLoadKotlinWith
doTest(fileName);
}
@TestMetadata("InnerTypes.kt")
public void testInnerTypes() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/InnerTypes.kt");
doTest(fileName);
}
@TestMetadata("NamedObject.kt")
public void testNamedObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/NamedObject.kt");
@@ -651,6 +651,12 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD
doTest(fileName);
}
@TestMetadata("InnerTypes.kt")
public void testInnerTypes() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/InnerTypes.kt");
doTest(fileName);
}
@TestMetadata("NamedObject.kt")
public void testNamedObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/NamedObject.kt");
@@ -5479,6 +5479,30 @@ public final class DebugProtoBuf {
* </pre>
*/
int getTypeParameterName();
// optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
boolean hasOuterType();
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type getOuterType();
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder getOuterTypeOrBuilder();
// optional int32 outer_type_id = 11;
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
boolean hasOuterTypeId();
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
int getOuterTypeId();
}
/**
* Protobuf type {@code org.jetbrains.kotlin.serialization.Type}
@@ -5582,6 +5606,24 @@ public final class DebugProtoBuf {
typeParameterName_ = input.readInt32();
break;
}
case 82: {
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder subBuilder = null;
if (((bitField0_ & 0x00000080) == 0x00000080)) {
subBuilder = outerType_.toBuilder();
}
outerType_ = input.readMessage(org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(outerType_);
outerType_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000080;
break;
}
case 88: {
bitField0_ |= 0x00000100;
outerTypeId_ = input.readInt32();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -6655,6 +6697,44 @@ public final class DebugProtoBuf {
return typeParameterName_;
}
// optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;
public static final int OUTER_TYPE_FIELD_NUMBER = 10;
private org.jetbrains.kotlin.serialization.DebugProtoBuf.Type outerType_;
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public boolean hasOuterType() {
return ((bitField0_ & 0x00000080) == 0x00000080);
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public org.jetbrains.kotlin.serialization.DebugProtoBuf.Type getOuterType() {
return outerType_;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder getOuterTypeOrBuilder() {
return outerType_;
}
// optional int32 outer_type_id = 11;
public static final int OUTER_TYPE_ID_FIELD_NUMBER = 11;
private int outerTypeId_;
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
public boolean hasOuterTypeId() {
return ((bitField0_ & 0x00000100) == 0x00000100);
}
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
public int getOuterTypeId() {
return outerTypeId_;
}
private void initFields() {
argument_ = java.util.Collections.emptyList();
nullable_ = false;
@@ -6664,6 +6744,8 @@ public final class DebugProtoBuf {
className_ = 0;
typeParameter_ = 0;
typeParameterName_ = 0;
outerType_ = org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.getDefaultInstance();
outerTypeId_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -6682,6 +6764,12 @@ public final class DebugProtoBuf {
return false;
}
}
if (hasOuterType()) {
if (!getOuterType().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (!extensionsAreInitialized()) {
memoizedIsInitialized = 0;
return false;
@@ -6720,6 +6808,12 @@ public final class DebugProtoBuf {
if (((bitField0_ & 0x00000040) == 0x00000040)) {
output.writeInt32(9, typeParameterName_);
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
output.writeMessage(10, outerType_);
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
output.writeInt32(11, outerTypeId_);
}
extensionWriter.writeUntil(200, output);
getUnknownFields().writeTo(output);
}
@@ -6762,6 +6856,14 @@ public final class DebugProtoBuf {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(9, typeParameterName_);
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(10, outerType_);
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(11, outerTypeId_);
}
size += extensionsSerializedSize();
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
@@ -6873,6 +6975,7 @@ public final class DebugProtoBuf {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getArgumentFieldBuilder();
getFlexibleUpperBoundFieldBuilder();
getOuterTypeFieldBuilder();
}
}
private static Builder create() {
@@ -6905,6 +7008,14 @@ public final class DebugProtoBuf {
bitField0_ = (bitField0_ & ~0x00000040);
typeParameterName_ = 0;
bitField0_ = (bitField0_ & ~0x00000080);
if (outerTypeBuilder_ == null) {
outerType_ = org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.getDefaultInstance();
} else {
outerTypeBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000100);
outerTypeId_ = 0;
bitField0_ = (bitField0_ & ~0x00000200);
return this;
}
@@ -6974,6 +7085,18 @@ public final class DebugProtoBuf {
to_bitField0_ |= 0x00000040;
}
result.typeParameterName_ = typeParameterName_;
if (((from_bitField0_ & 0x00000100) == 0x00000100)) {
to_bitField0_ |= 0x00000080;
}
if (outerTypeBuilder_ == null) {
result.outerType_ = outerType_;
} else {
result.outerType_ = outerTypeBuilder_.build();
}
if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
to_bitField0_ |= 0x00000100;
}
result.outerTypeId_ = outerTypeId_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
@@ -7037,6 +7160,12 @@ public final class DebugProtoBuf {
if (other.hasTypeParameterName()) {
setTypeParameterName(other.getTypeParameterName());
}
if (other.hasOuterType()) {
mergeOuterType(other.getOuterType());
}
if (other.hasOuterTypeId()) {
setOuterTypeId(other.getOuterTypeId());
}
this.mergeExtensionFields(other);
this.mergeUnknownFields(other.getUnknownFields());
return this;
@@ -7055,6 +7184,12 @@ public final class DebugProtoBuf {
return false;
}
}
if (hasOuterType()) {
if (!getOuterType().isInitialized()) {
return false;
}
}
if (!extensionsAreInitialized()) {
return false;
@@ -7688,6 +7823,156 @@ public final class DebugProtoBuf {
return this;
}
// optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;
private org.jetbrains.kotlin.serialization.DebugProtoBuf.Type outerType_ = org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.getDefaultInstance();
private com.google.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type, org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder> outerTypeBuilder_;
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public boolean hasOuterType() {
return ((bitField0_ & 0x00000100) == 0x00000100);
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public org.jetbrains.kotlin.serialization.DebugProtoBuf.Type getOuterType() {
if (outerTypeBuilder_ == null) {
return outerType_;
} else {
return outerTypeBuilder_.getMessage();
}
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public Builder setOuterType(org.jetbrains.kotlin.serialization.DebugProtoBuf.Type value) {
if (outerTypeBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
outerType_ = value;
onChanged();
} else {
outerTypeBuilder_.setMessage(value);
}
bitField0_ |= 0x00000100;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public Builder setOuterType(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder builderForValue) {
if (outerTypeBuilder_ == null) {
outerType_ = builderForValue.build();
onChanged();
} else {
outerTypeBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000100;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public Builder mergeOuterType(org.jetbrains.kotlin.serialization.DebugProtoBuf.Type value) {
if (outerTypeBuilder_ == null) {
if (((bitField0_ & 0x00000100) == 0x00000100) &&
outerType_ != org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.getDefaultInstance()) {
outerType_ =
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.newBuilder(outerType_).mergeFrom(value).buildPartial();
} else {
outerType_ = value;
}
onChanged();
} else {
outerTypeBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000100;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public Builder clearOuterType() {
if (outerTypeBuilder_ == null) {
outerType_ = org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.getDefaultInstance();
onChanged();
} else {
outerTypeBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000100);
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder getOuterTypeBuilder() {
bitField0_ |= 0x00000100;
onChanged();
return getOuterTypeFieldBuilder().getBuilder();
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder getOuterTypeOrBuilder() {
if (outerTypeBuilder_ != null) {
return outerTypeBuilder_.getMessageOrBuilder();
} else {
return outerType_;
}
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type, org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder>
getOuterTypeFieldBuilder() {
if (outerTypeBuilder_ == null) {
outerTypeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type, org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder>(
outerType_,
getParentForChildren(),
isClean());
outerType_ = null;
}
return outerTypeBuilder_;
}
// optional int32 outer_type_id = 11;
private int outerTypeId_ ;
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
public boolean hasOuterTypeId() {
return ((bitField0_ & 0x00000200) == 0x00000200);
}
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
public int getOuterTypeId() {
return outerTypeId_;
}
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
public Builder setOuterTypeId(int value) {
bitField0_ |= 0x00000200;
outerTypeId_ = value;
onChanged();
return this;
}
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
public Builder clearOuterTypeId() {
bitField0_ = (bitField0_ & ~0x00000200);
outerTypeId_ = 0;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.Type)
}
@@ -20678,7 +20963,7 @@ public final class DebugProtoBuf {
"\n\004BYTE\020\000\022\010\n\004CHAR\020\001\022\t\n\005SHORT\020\002\022\007\n\003INT\020\003\022\010" +
"\n\004LONG\020\004\022\t\n\005FLOAT\020\005\022\n\n\006DOUBLE\020\006\022\013\n\007BOOLE",
"AN\020\007\022\n\n\006STRING\020\010\022\t\n\005CLASS\020\t\022\010\n\004ENUM\020\n\022\016\n" +
"\nANNOTATION\020\013\022\t\n\005ARRAY\020\014\"\265\004\n\004Type\022C\n\010arg" +
"\nANNOTATION\020\013\022\t\n\005ARRAY\020\014\"\212\005\n\004Type\022C\n\010arg" +
"ument\030\002 \003(\01321.org.jetbrains.kotlin.seria" +
"lization.Type.Argument\022\027\n\010nullable\030\003 \001(\010" +
":\005false\022+\n\035flexible_type_capabilities_id" +
@@ -20687,83 +20972,85 @@ public final class DebugProtoBuf {
"Type\022\037\n\027flexible_upper_bound_id\030\010 \001(\005\022\030\n" +
"\nclass_name\030\006 \001(\005B\004\220\265\030\001\022\026\n\016type_paramete" +
"r\030\007 \001(\005\022!\n\023type_parameter_name\030\t \001(\005B\004\210\265",
"\030\001\032\334\001\n\010Argument\022U\n\nprojection\030\001 \001(\0162<.or" +
"g.jetbrains.kotlin.serialization.Type.Ar" +
"gument.Projection:\003INV\0226\n\004type\030\002 \001(\0132(.o" +
"rg.jetbrains.kotlin.serialization.Type\022\017" +
"\n\007type_id\030\003 \001(\005\"0\n\nProjection\022\006\n\002IN\020\000\022\007\n" +
"\003OUT\020\001\022\007\n\003INV\020\002\022\010\n\004STAR\020\003*\005\010d\020\310\001\"\236\002\n\rTyp" +
"eParameter\022\n\n\002id\030\001 \002(\005\022\022\n\004name\030\002 \002(\005B\004\210\265" +
"\030\001\022\026\n\007reified\030\003 \001(\010:\005false\022Q\n\010variance\030\004" +
" \001(\0162:.org.jetbrains.kotlin.serializatio" +
"n.TypeParameter.Variance:\003INV\022=\n\013upper_b",
"ound\030\005 \003(\0132(.org.jetbrains.kotlin.serial" +
"ization.Type\022\026\n\016upper_bound_id\030\006 \003(\005\"$\n\010" +
"Variance\022\006\n\002IN\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*\005\010d\020\350" +
"\007\"\300\005\n\005Class\022\020\n\005flags\030\001 \001(\005:\0016\022\025\n\007fq_name" +
"\030\003 \002(\005B\004\220\265\030\001\022#\n\025companion_object_name\030\004 " +
"\001(\005B\004\210\265\030\001\022I\n\016type_parameter\030\005 \003(\01321.org." +
"jetbrains.kotlin.serialization.TypeParam" +
"eter\022;\n\tsupertype\030\006 \003(\0132(.org.jetbrains." +
"kotlin.serialization.Type\022\030\n\014supertype_i" +
"d\030\002 \003(\005B\002\020\001\022!\n\021nested_class_name\030\007 \003(\005B\006",
"\020\001\210\265\030\001\022D\n\013constructor\030\010 \003(\0132/.org.jetbra" +
"ins.kotlin.serialization.Constructor\022>\n\010" +
"function\030\t \003(\0132,.org.jetbrains.kotlin.se" +
"rialization.Function\022>\n\010property\030\n \003(\0132," +
".org.jetbrains.kotlin.serialization.Prop" +
"erty\022\032\n\nenum_entry\030\014 \003(\005B\006\020\001\210\265\030\001\022A\n\ntype" +
"_table\030\036 \001(\0132-.org.jetbrains.kotlin.seri" +
"alization.TypeTable\"x\n\004Kind\022\t\n\005CLASS\020\000\022\r" +
"\n\tINTERFACE\020\001\022\016\n\nENUM_CLASS\020\002\022\016\n\nENUM_EN" +
"TRY\020\003\022\024\n\020ANNOTATION_CLASS\020\004\022\n\n\006OBJECT\020\005\022",
"\024\n\020COMPANION_OBJECT\020\006*\005\010d\020\310\001\"\323\001\n\007Package" +
"\022>\n\010function\030\003 \003(\0132,.org.jetbrains.kotli" +
"n.serialization.Function\022>\n\010property\030\004 \003" +
"(\0132,.org.jetbrains.kotlin.serialization." +
"Property\022A\n\ntype_table\030\036 \001(\0132-.org.jetbr" +
"ains.kotlin.serialization.TypeTable*\005\010d\020" +
"\310\001\"_\n\tTypeTable\0226\n\004type\030\001 \003(\0132(.org.jetb" +
"rains.kotlin.serialization.Type\022\032\n\016first" +
"_nullable\030\002 \001(\005:\002-1\"s\n\013Constructor\022\020\n\005fl" +
"ags\030\001 \001(\005:\0016\022K\n\017value_parameter\030\002 \003(\01322.",
"org.jetbrains.kotlin.serialization.Value" +
"Parameter*\005\010d\020\310\001\"\304\003\n\010Function\022\020\n\005flags\030\001" +
" \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022=\n\013return_ty" +
"pe\030\003 \001(\0132(.org.jetbrains.kotlin.serializ" +
"ation.Type\022\026\n\016return_type_id\030\007 \001(\005\022I\n\016ty" +
"pe_parameter\030\004 \003(\01321.org.jetbrains.kotli" +
"n.serialization.TypeParameter\022?\n\rreceive" +
"r_type\030\005 \001(\0132(.org.jetbrains.kotlin.seri" +
"alization.Type\022\030\n\020receiver_type_id\030\010 \001(\005" +
"\022K\n\017value_parameter\030\006 \003(\01322.org.jetbrain",
"s.kotlin.serialization.ValueParameter\022A\n" +
"\030\001\022<\n\nouter_type\030\n \001(\0132(.org.jetbrains.k" +
"otlin.serialization.Type\022\025\n\router_type_i" +
"d\030\013 \001(\005\032\334\001\n\010Argument\022U\n\nprojection\030\001 \001(\016" +
"2<.org.jetbrains.kotlin.serialization.Ty" +
"pe.Argument.Projection:\003INV\0226\n\004type\030\002 \001(" +
"\0132(.org.jetbrains.kotlin.serialization.T" +
"ype\022\017\n\007type_id\030\003 \001(\005\"0\n\nProjection\022\006\n\002IN" +
"\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002\022\010\n\004STAR\020\003*\005\010d\020\310\001\"\236\002" +
"\n\rTypeParameter\022\n\n\002id\030\001 \002(\005\022\022\n\004name\030\002 \002(" +
"\005B\004\210\265\030\001\022\026\n\007reified\030\003 \001(\010:\005false\022Q\n\010varia",
"nce\030\004 \001(\0162:.org.jetbrains.kotlin.seriali" +
"zation.TypeParameter.Variance:\003INV\022=\n\013up" +
"per_bound\030\005 \003(\0132(.org.jetbrains.kotlin.s" +
"erialization.Type\022\026\n\016upper_bound_id\030\006 \003(" +
"\005\"$\n\010Variance\022\006\n\002IN\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*" +
"\005\010d\020\350\007\"\300\005\n\005Class\022\020\n\005flags\030\001 \001(\005:\0016\022\025\n\007fq" +
"_name\030\003 \002(\005B\004\220\265\030\001\022#\n\025companion_object_na" +
"me\030\004 \001(\005B\004\210\265\030\001\022I\n\016type_parameter\030\005 \003(\01321" +
".org.jetbrains.kotlin.serialization.Type" +
"Parameter\022;\n\tsupertype\030\006 \003(\0132(.org.jetbr",
"ains.kotlin.serialization.Type\022\030\n\014supert" +
"ype_id\030\002 \003(\005B\002\020\001\022!\n\021nested_class_name\030\007 " +
"\003(\005B\006\020\001\210\265\030\001\022D\n\013constructor\030\010 \003(\0132/.org.j" +
"etbrains.kotlin.serialization.Constructo" +
"r\022>\n\010function\030\t \003(\0132,.org.jetbrains.kotl" +
"in.serialization.Function\022>\n\010property\030\n " +
"\003(\0132,.org.jetbrains.kotlin.serialization" +
".Property\022\032\n\nenum_entry\030\014 \003(\005B\006\020\001\210\265\030\001\022A\n" +
"\ntype_table\030\036 \001(\0132-.org.jetbrains.kotlin" +
".serialization.TypeTable*\005\010d\020\310\001\"\266\003\n\010Prop" +
"erty\022\022\n\005flags\030\001 \001(\005:\003262\022\022\n\004name\030\002 \002(\005B\004" +
"\210\265\030\001\022=\n\013return_type\030\003 \001(\0132(.org.jetbrain" +
"s.kotlin.serialization.Type\022\026\n\016return_ty" +
"pe_id\030\t \001(\005\022I\n\016type_parameter\030\004 \003(\01321.or" +
"g.jetbrains.kotlin.serialization.TypePar" +
"ameter\022?\n\rreceiver_type\030\005 \001(\0132(.org.jetb" +
"rains.kotlin.serialization.Type\022\030\n\020recei",
"ver_type_id\030\n \001(\005\022R\n\026setter_value_parame" +
"ter\030\006 \001(\01322.org.jetbrains.kotlin.seriali" +
"zation.ValueParameter\022\024\n\014getter_flags\030\007 " +
"\001(\005\022\024\n\014setter_flags\030\010 \001(\005*\005\010d\020\310\001\"\355\001\n\016Val" +
"ueParameter\022\020\n\005flags\030\001 \001(\005:\0010\022\022\n\004name\030\002 " +
"\002(\005B\004\210\265\030\001\0226\n\004type\030\003 \001(\0132(.org.jetbrains." +
"kotlin.serialization.Type\022\017\n\007type_id\030\005 \001" +
"(\005\022E\n\023vararg_element_type\030\004 \001(\0132(.org.je" +
"tbrains.kotlin.serialization.Type\022\036\n\026var" +
"arg_element_type_id\030\006 \001(\005*\005\010d\020\310\001*9\n\010Moda",
"lity\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRACT\020\002\022" +
"\n\n\006SEALED\020\003*b\n\nVisibility\022\014\n\010INTERNAL\020\000\022" +
"\013\n\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLIC\020\003\022" +
"\023\n\017PRIVATE_TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nMembe" +
"rKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE_OVERRIDE\020" +
"\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003B\022B\rDe" +
"bugProtoBuf\210\001\000"
".serialization.TypeTable\"x\n\004Kind\022\t\n\005CLAS",
"S\020\000\022\r\n\tINTERFACE\020\001\022\016\n\nENUM_CLASS\020\002\022\016\n\nEN" +
"UM_ENTRY\020\003\022\024\n\020ANNOTATION_CLASS\020\004\022\n\n\006OBJE" +
"CT\020\005\022\024\n\020COMPANION_OBJECT\020\006*\005\010d\020\310\001\"\323\001\n\007Pa" +
"ckage\022>\n\010function\030\003 \003(\0132,.org.jetbrains." +
"kotlin.serialization.Function\022>\n\010propert" +
"y\030\004 \003(\0132,.org.jetbrains.kotlin.serializa" +
"tion.Property\022A\n\ntype_table\030\036 \001(\0132-.org." +
"jetbrains.kotlin.serialization.TypeTable" +
"*\005\010d\020\310\001\"_\n\tTypeTable\0226\n\004type\030\001 \003(\0132(.org" +
".jetbrains.kotlin.serialization.Type\022\032\n\016",
"first_nullable\030\002 \001(\005:\002-1\"s\n\013Constructor\022" +
"\020\n\005flags\030\001 \001(\005:\0016\022K\n\017value_parameter\030\002 \003" +
"(\01322.org.jetbrains.kotlin.serialization." +
"ValueParameter*\005\010d\020\310\001\"\304\003\n\010Function\022\020\n\005fl" +
"ags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022=\n\013retu" +
"rn_type\030\003 \001(\0132(.org.jetbrains.kotlin.ser" +
"ialization.Type\022\026\n\016return_type_id\030\007 \001(\005\022" +
"I\n\016type_parameter\030\004 \003(\01321.org.jetbrains." +
"kotlin.serialization.TypeParameter\022?\n\rre" +
"ceiver_type\030\005 \001(\0132(.org.jetbrains.kotlin",
".serialization.Type\022\030\n\020receiver_type_id\030" +
"\010 \001(\005\022K\n\017value_parameter\030\006 \003(\01322.org.jet" +
"brains.kotlin.serialization.ValueParamet" +
"er\022A\n\ntype_table\030\036 \001(\0132-.org.jetbrains.k" +
"otlin.serialization.TypeTable*\005\010d\020\310\001\"\266\003\n" +
"\010Property\022\022\n\005flags\030\001 \001(\005:\003262\022\022\n\004name\030\002 " +
"\002(\005B\004\210\265\030\001\022=\n\013return_type\030\003 \001(\0132(.org.jet" +
"brains.kotlin.serialization.Type\022\026\n\016retu" +
"rn_type_id\030\t \001(\005\022I\n\016type_parameter\030\004 \003(\013" +
"21.org.jetbrains.kotlin.serialization.Ty",
"peParameter\022?\n\rreceiver_type\030\005 \001(\0132(.org" +
".jetbrains.kotlin.serialization.Type\022\030\n\020" +
"receiver_type_id\030\n \001(\005\022R\n\026setter_value_p" +
"arameter\030\006 \001(\01322.org.jetbrains.kotlin.se" +
"rialization.ValueParameter\022\024\n\014getter_fla" +
"gs\030\007 \001(\005\022\024\n\014setter_flags\030\010 \001(\005*\005\010d\020\310\001\"\355\001" +
"\n\016ValueParameter\022\020\n\005flags\030\001 \001(\005:\0010\022\022\n\004na" +
"me\030\002 \002(\005B\004\210\265\030\001\0226\n\004type\030\003 \001(\0132(.org.jetbr" +
"ains.kotlin.serialization.Type\022\017\n\007type_i" +
"d\030\005 \001(\005\022E\n\023vararg_element_type\030\004 \001(\0132(.o",
"rg.jetbrains.kotlin.serialization.Type\022\036" +
"\n\026vararg_element_type_id\030\006 \001(\005*\005\010d\020\310\001*9\n" +
"\010Modality\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRA" +
"CT\020\002\022\n\n\006SEALED\020\003*b\n\nVisibility\022\014\n\010INTERN" +
"AL\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBL" +
"IC\020\003\022\023\n\017PRIVATE_TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\n" +
"MemberKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE_OVER" +
"RIDE\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003B" +
"\022B\rDebugProtoBuf\210\001\000"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -20811,7 +21098,7 @@ public final class DebugProtoBuf {
internal_static_org_jetbrains_kotlin_serialization_Type_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jetbrains_kotlin_serialization_Type_descriptor,
new java.lang.String[] { "Argument", "Nullable", "FlexibleTypeCapabilitiesId", "FlexibleUpperBound", "FlexibleUpperBoundId", "ClassName", "TypeParameter", "TypeParameterName", });
new java.lang.String[] { "Argument", "Nullable", "FlexibleTypeCapabilitiesId", "FlexibleUpperBound", "FlexibleUpperBoundId", "ClassName", "TypeParameter", "TypeParameterName", "OuterType", "OuterTypeId", });
internal_static_org_jetbrains_kotlin_serialization_Type_Argument_descriptor =
internal_static_org_jetbrains_kotlin_serialization_Type_descriptor.getNestedTypes().get(0);
internal_static_org_jetbrains_kotlin_serialization_Type_Argument_fieldAccessorTable = new
@@ -129,6 +129,9 @@ message Type {
// Name of the type parameter in the immediate owner
optional int32 type_parameter_name = 9 [(name_id_in_table) = true];
optional Type outer_type = 10;
optional int32 outer_type_id = 11;
extensions 100 to 199;
}
@@ -4353,6 +4353,26 @@ public final class ProtoBuf {
* </pre>
*/
int getTypeParameterName();
// optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
boolean hasOuterType();
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
org.jetbrains.kotlin.serialization.ProtoBuf.Type getOuterType();
// optional int32 outer_type_id = 11;
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
boolean hasOuterTypeId();
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
int getOuterTypeId();
}
/**
* Protobuf type {@code org.jetbrains.kotlin.serialization.Type}
@@ -4448,6 +4468,24 @@ public final class ProtoBuf {
typeParameterName_ = input.readInt32();
break;
}
case 82: {
org.jetbrains.kotlin.serialization.ProtoBuf.Type.Builder subBuilder = null;
if (((bitField0_ & 0x00000080) == 0x00000080)) {
subBuilder = outerType_.toBuilder();
}
outerType_ = input.readMessage(org.jetbrains.kotlin.serialization.ProtoBuf.Type.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(outerType_);
outerType_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000080;
break;
}
case 88: {
bitField0_ |= 0x00000100;
outerTypeId_ = input.readInt32();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -5316,6 +5354,38 @@ public final class ProtoBuf {
return typeParameterName_;
}
// optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;
public static final int OUTER_TYPE_FIELD_NUMBER = 10;
private org.jetbrains.kotlin.serialization.ProtoBuf.Type outerType_;
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public boolean hasOuterType() {
return ((bitField0_ & 0x00000080) == 0x00000080);
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public org.jetbrains.kotlin.serialization.ProtoBuf.Type getOuterType() {
return outerType_;
}
// optional int32 outer_type_id = 11;
public static final int OUTER_TYPE_ID_FIELD_NUMBER = 11;
private int outerTypeId_;
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
public boolean hasOuterTypeId() {
return ((bitField0_ & 0x00000100) == 0x00000100);
}
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
public int getOuterTypeId() {
return outerTypeId_;
}
private void initFields() {
argument_ = java.util.Collections.emptyList();
nullable_ = false;
@@ -5325,6 +5395,8 @@ public final class ProtoBuf {
className_ = 0;
typeParameter_ = 0;
typeParameterName_ = 0;
outerType_ = org.jetbrains.kotlin.serialization.ProtoBuf.Type.getDefaultInstance();
outerTypeId_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -5343,6 +5415,12 @@ public final class ProtoBuf {
return false;
}
}
if (hasOuterType()) {
if (!getOuterType().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (!extensionsAreInitialized()) {
memoizedIsInitialized = 0;
return false;
@@ -5381,6 +5459,12 @@ public final class ProtoBuf {
if (((bitField0_ & 0x00000040) == 0x00000040)) {
output.writeInt32(9, typeParameterName_);
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
output.writeMessage(10, outerType_);
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
output.writeInt32(11, outerTypeId_);
}
extensionWriter.writeUntil(200, output);
}
@@ -5422,6 +5506,14 @@ public final class ProtoBuf {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(9, typeParameterName_);
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(10, outerType_);
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(11, outerTypeId_);
}
size += extensionsSerializedSize();
memoizedSerializedSize = size;
return size;
@@ -5529,6 +5621,10 @@ public final class ProtoBuf {
bitField0_ = (bitField0_ & ~0x00000040);
typeParameterName_ = 0;
bitField0_ = (bitField0_ & ~0x00000080);
outerType_ = org.jetbrains.kotlin.serialization.ProtoBuf.Type.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000100);
outerTypeId_ = 0;
bitField0_ = (bitField0_ & ~0x00000200);
return this;
}
@@ -5585,6 +5681,14 @@ public final class ProtoBuf {
to_bitField0_ |= 0x00000040;
}
result.typeParameterName_ = typeParameterName_;
if (((from_bitField0_ & 0x00000100) == 0x00000100)) {
to_bitField0_ |= 0x00000080;
}
result.outerType_ = outerType_;
if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
to_bitField0_ |= 0x00000100;
}
result.outerTypeId_ = outerTypeId_;
result.bitField0_ = to_bitField0_;
return result;
}
@@ -5622,6 +5726,12 @@ public final class ProtoBuf {
if (other.hasTypeParameterName()) {
setTypeParameterName(other.getTypeParameterName());
}
if (other.hasOuterType()) {
mergeOuterType(other.getOuterType());
}
if (other.hasOuterTypeId()) {
setOuterTypeId(other.getOuterTypeId());
}
this.mergeExtensionFields(other);
return this;
}
@@ -5639,6 +5749,12 @@ public final class ProtoBuf {
return false;
}
}
if (hasOuterType()) {
if (!getOuterType().isInitialized()) {
return false;
}
}
if (!extensionsAreInitialized()) {
return false;
@@ -6101,6 +6217,100 @@ public final class ProtoBuf {
return this;
}
// optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;
private org.jetbrains.kotlin.serialization.ProtoBuf.Type outerType_ = org.jetbrains.kotlin.serialization.ProtoBuf.Type.getDefaultInstance();
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public boolean hasOuterType() {
return ((bitField0_ & 0x00000100) == 0x00000100);
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public org.jetbrains.kotlin.serialization.ProtoBuf.Type getOuterType() {
return outerType_;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public Builder setOuterType(org.jetbrains.kotlin.serialization.ProtoBuf.Type value) {
if (value == null) {
throw new NullPointerException();
}
outerType_ = value;
bitField0_ |= 0x00000100;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public Builder setOuterType(
org.jetbrains.kotlin.serialization.ProtoBuf.Type.Builder builderForValue) {
outerType_ = builderForValue.build();
bitField0_ |= 0x00000100;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public Builder mergeOuterType(org.jetbrains.kotlin.serialization.ProtoBuf.Type value) {
if (((bitField0_ & 0x00000100) == 0x00000100) &&
outerType_ != org.jetbrains.kotlin.serialization.ProtoBuf.Type.getDefaultInstance()) {
outerType_ =
org.jetbrains.kotlin.serialization.ProtoBuf.Type.newBuilder(outerType_).mergeFrom(value).buildPartial();
} else {
outerType_ = value;
}
bitField0_ |= 0x00000100;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.serialization.Type outer_type = 10;</code>
*/
public Builder clearOuterType() {
outerType_ = org.jetbrains.kotlin.serialization.ProtoBuf.Type.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000100);
return this;
}
// optional int32 outer_type_id = 11;
private int outerTypeId_ ;
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
public boolean hasOuterTypeId() {
return ((bitField0_ & 0x00000200) == 0x00000200);
}
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
public int getOuterTypeId() {
return outerTypeId_;
}
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
public Builder setOuterTypeId(int value) {
bitField0_ |= 0x00000200;
outerTypeId_ = value;
return this;
}
/**
* <code>optional int32 outer_type_id = 11;</code>
*/
public Builder clearOuterTypeId() {
bitField0_ = (bitField0_ & ~0x00000200);
outerTypeId_ = 0;
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.Type)
}
@@ -20,9 +20,7 @@ import org.jetbrains.kotlin.descriptors.annotations.AnnotationWithTarget
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedAnnotationsWithPossibleTargets
import org.jetbrains.kotlin.types.AbstractLazyType
import org.jetbrains.kotlin.types.ErrorUtils
import org.jetbrains.kotlin.types.LazyType
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.utils.toReadOnlyList
class DeserializedType(
@@ -34,11 +32,16 @@ class DeserializedType(
override fun computeTypeConstructor() = typeDeserializer.typeConstructor(typeProto)
override fun computeArguments() =
typeProto.argumentList.mapIndexed {
index, proto ->
typeDeserializer.typeArgument(constructor.parameters.getOrNull(index), proto)
}.toReadOnlyList()
override fun computeArguments() = typeProto.collectAllArguments().deserialize()
private fun ProtoBuf.Type.collectAllArguments(): List<ProtoBuf.Type.Argument> =
argumentList + outerType(c.typeTable)?.collectAllArguments().orEmpty()
private fun List<ProtoBuf.Type.Argument>.deserialize(): List<TypeProjection> =
mapIndexed {
index, proto ->
typeDeserializer.typeArgument(constructor.parameters.getOrNull(index), proto)
}.toReadOnlyList()
private val annotations = DeserializedAnnotationsWithPossibleTargets(c.storageManager) {
c.components.annotationAndConstantLoader
@@ -78,3 +78,11 @@ fun ProtoBuf.ValueParameter.varargElementType(typeTable: TypeTable): ProtoBuf.Ty
else -> null
}
}
fun ProtoBuf.Type.outerType(typeTable: TypeTable): ProtoBuf.Type? {
return when {
hasOuterType() -> outerType
hasOuterTypeId() -> typeTable[outerTypeId]
else -> null
}
}
@@ -649,6 +649,12 @@ public class ResolveByStubTestGenerated extends AbstractResolveByStubTest {
doTest(fileName);
}
@TestMetadata("InnerTypes.kt")
public void testInnerTypes() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/InnerTypes.kt");
doTest(fileName);
}
@TestMetadata("NamedObject.kt")
public void testNamedObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/NamedObject.kt");
@@ -355,6 +355,16 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
if (!checkStringEquals(old.typeParameterName, new.typeParameterName)) return false
}
if (old.hasOuterType() != new.hasOuterType()) return false
if (old.hasOuterType()) {
if (!checkEquals(old.outerType, new.outerType)) return false
}
if (old.hasOuterTypeId() != new.hasOuterTypeId()) return false
if (old.hasOuterTypeId()) {
if (old.outerTypeId != new.outerTypeId) return false
}
if (old.getExtensionCount(JvmProtoBuf.typeAnnotation) != new.getExtensionCount(JvmProtoBuf.typeAnnotation)) return false
for(i in 0..old.getExtensionCount(JvmProtoBuf.typeAnnotation) - 1) {
@@ -1043,6 +1053,14 @@ public fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I
hashCode = 31 * hashCode + stringIndexes(typeParameterName)
}
if (hasOuterType()) {
hashCode = 31 * hashCode + outerType.hashCode(stringIndexes, fqNameIndexes)
}
if (hasOuterTypeId()) {
hashCode = 31 * hashCode + outerTypeId
}
for(i in 0..getExtensionCount(JvmProtoBuf.typeAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.typeAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}