Serialize/deserialize annotations on type parameters
This commit is contained in:
+9
@@ -90,6 +90,15 @@ public class JvmSerializerExtension extends SerializerExtension {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeTypeParameter(
|
||||
@NotNull TypeParameterDescriptor typeParameter, @NotNull ProtoBuf.TypeParameter.Builder proto
|
||||
) {
|
||||
for (AnnotationDescriptor annotation : typeParameter.getAnnotations()) {
|
||||
proto.addExtension(JvmProtoBuf.typeParameterAnnotation, annotationSerializer.serializeAnnotation(annotation));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeConstructor(@NotNull ConstructorDescriptor descriptor, @NotNull ProtoBuf.Constructor.Builder proto) {
|
||||
Method method = bindings.get(METHOD_FOR_FUNCTION, descriptor);
|
||||
|
||||
+1
@@ -407,6 +407,7 @@ public class DescriptorSerializer {
|
||||
if (variance != builder.getVariance()) {
|
||||
builder.setVariance(variance);
|
||||
}
|
||||
extension.serializeTypeParameter(typeParameter, builder);
|
||||
|
||||
Set<JetType> upperBounds = typeParameter.getUpperBounds();
|
||||
if (upperBounds.size() == 1 && KotlinBuiltIns.isDefaultBound(CollectionsKt.single(upperBounds))) return builder;
|
||||
|
||||
@@ -50,4 +50,7 @@ public abstract class SerializerExtension {
|
||||
|
||||
public void serializeType(@NotNull JetType type, @NotNull ProtoBuf.Type.Builder proto) {
|
||||
}
|
||||
|
||||
public void serializeTypeParameter(@NotNull TypeParameterDescriptor typeParameter, @NotNull ProtoBuf.TypeParameter.Builder proto) {
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// ALLOW_AST_ACCESS
|
||||
|
||||
package test
|
||||
|
||||
@Target(AnnotationTarget.TYPE_PARAMETER)
|
||||
annotation class A
|
||||
|
||||
class SimpleTypeParameterAnnotation {
|
||||
fun <@A T> foo(x: T) {}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) @kotlin.annotation.annotation() public final class A : kotlin.Annotation {
|
||||
/*primary*/ public constructor A()
|
||||
}
|
||||
|
||||
public final class SimpleTypeParameterAnnotation {
|
||||
/*primary*/ public constructor SimpleTypeParameterAnnotation()
|
||||
public final fun </*0*/ T> foo(/*0*/ x: T): kotlin.Unit
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// ALLOW_AST_ACCESS
|
||||
|
||||
package test
|
||||
|
||||
@Target(AnnotationTarget.TYPE_PARAMETER)
|
||||
annotation class A(val x: String, val y: Double)
|
||||
|
||||
class SimpleTypeParameterAnnotation {
|
||||
fun <@A("a", 1.0) T> foo(x: T) {}
|
||||
}
|
||||
compiler/testData/loadJava/compiledKotlin/annotations/types/TypeParameterAnnotationWithArguments.txt
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) @kotlin.annotation.annotation() public final class A : kotlin.Annotation {
|
||||
/*primary*/ public constructor A(/*0*/ x: kotlin.String, /*1*/ y: kotlin.Double)
|
||||
public final val x: kotlin.String
|
||||
public final fun <get-x>(): kotlin.String
|
||||
public final val y: kotlin.Double
|
||||
public final fun <get-y>(): kotlin.Double
|
||||
}
|
||||
|
||||
public final class SimpleTypeParameterAnnotation {
|
||||
/*primary*/ public constructor SimpleTypeParameterAnnotation()
|
||||
public final fun </*0*/ T> foo(/*0*/ x: T): kotlin.Unit
|
||||
}
|
||||
@@ -2378,6 +2378,18 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeAnnotationWithArguments.kt");
|
||||
doTestCompiledKotlin(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeParameterAnnotation.kt")
|
||||
public void testTypeParameterAnnotation() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeParameterAnnotation.kt");
|
||||
doTestCompiledKotlin(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeParameterAnnotationWithArguments.kt")
|
||||
public void testTypeParameterAnnotationWithArguments() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeParameterAnnotationWithArguments.kt");
|
||||
doTestCompiledKotlin(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledKotlin/annotations/withUseSiteTarget")
|
||||
|
||||
+12
@@ -467,6 +467,18 @@ public class LoadKotlinWithTypeTableTestGenerated extends AbstractLoadKotlinWith
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeAnnotationWithArguments.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeParameterAnnotation.kt")
|
||||
public void testTypeParameterAnnotation() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeParameterAnnotation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeParameterAnnotationWithArguments.kt")
|
||||
public void testTypeParameterAnnotationWithArguments() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeParameterAnnotationWithArguments.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledKotlin/annotations/withUseSiteTarget")
|
||||
|
||||
+12
@@ -469,6 +469,18 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeAnnotationWithArguments.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeParameterAnnotation.kt")
|
||||
public void testTypeParameterAnnotation() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeParameterAnnotation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeParameterAnnotationWithArguments.kt")
|
||||
public void testTypeParameterAnnotationWithArguments() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeParameterAnnotationWithArguments.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledKotlin/annotations/withUseSiteTarget")
|
||||
|
||||
@@ -7699,8 +7699,9 @@ public final class DebugProtoBuf {
|
||||
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.serialization.Type)
|
||||
}
|
||||
|
||||
public interface TypeParameterOrBuilder
|
||||
extends com.google.protobuf.MessageOrBuilder {
|
||||
public interface TypeParameterOrBuilder extends
|
||||
com.google.protobuf.GeneratedMessage.
|
||||
ExtendableMessageOrBuilder<TypeParameter> {
|
||||
|
||||
// required int32 id = 1;
|
||||
/**
|
||||
@@ -7785,10 +7786,10 @@ public final class DebugProtoBuf {
|
||||
* Protobuf type {@code org.jetbrains.kotlin.serialization.TypeParameter}
|
||||
*/
|
||||
public static final class TypeParameter extends
|
||||
com.google.protobuf.GeneratedMessage
|
||||
implements TypeParameterOrBuilder {
|
||||
com.google.protobuf.GeneratedMessage.ExtendableMessage<
|
||||
TypeParameter> implements TypeParameterOrBuilder {
|
||||
// Use TypeParameter.newBuilder() to construct.
|
||||
private TypeParameter(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
|
||||
private TypeParameter(com.google.protobuf.GeneratedMessage.ExtendableBuilder<org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeParameter, ?> builder) {
|
||||
super(builder);
|
||||
this.unknownFields = builder.getUnknownFields();
|
||||
}
|
||||
@@ -8174,6 +8175,10 @@ public final class DebugProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!extensionsAreInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
return false;
|
||||
}
|
||||
memoizedIsInitialized = 1;
|
||||
return true;
|
||||
}
|
||||
@@ -8181,6 +8186,9 @@ public final class DebugProtoBuf {
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
getSerializedSize();
|
||||
com.google.protobuf.GeneratedMessage
|
||||
.ExtendableMessage<org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeParameter>.ExtensionWriter extensionWriter =
|
||||
newExtensionWriter();
|
||||
if (((bitField0_ & 0x00000001) == 0x00000001)) {
|
||||
output.writeInt32(1, id_);
|
||||
}
|
||||
@@ -8199,6 +8207,7 @@ public final class DebugProtoBuf {
|
||||
for (int i = 0; i < upperBoundId_.size(); i++) {
|
||||
output.writeInt32(6, upperBoundId_.get(i));
|
||||
}
|
||||
extensionWriter.writeUntil(1000, output);
|
||||
getUnknownFields().writeTo(output);
|
||||
}
|
||||
|
||||
@@ -8237,6 +8246,7 @@ public final class DebugProtoBuf {
|
||||
size += dataSize;
|
||||
size += 1 * getUpperBoundIdList().size();
|
||||
}
|
||||
size += extensionsSerializedSize();
|
||||
size += getUnknownFields().getSerializedSize();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
@@ -8319,8 +8329,8 @@ public final class DebugProtoBuf {
|
||||
* Protobuf type {@code org.jetbrains.kotlin.serialization.TypeParameter}
|
||||
*/
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessage.Builder<Builder>
|
||||
implements org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeParameterOrBuilder {
|
||||
com.google.protobuf.GeneratedMessage.ExtendableBuilder<
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeParameter, Builder> implements org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeParameterOrBuilder {
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return org.jetbrains.kotlin.serialization.DebugProtoBuf.internal_static_org_jetbrains_kotlin_serialization_TypeParameter_descriptor;
|
||||
@@ -8492,6 +8502,7 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
onChanged();
|
||||
}
|
||||
this.mergeExtensionFields(other);
|
||||
this.mergeUnknownFields(other.getUnknownFields());
|
||||
return this;
|
||||
}
|
||||
@@ -8511,6 +8522,10 @@ public final class DebugProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!extensionsAreInitialized()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20621,78 +20636,78 @@ public final class DebugProtoBuf {
|
||||
"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\"\227\002\n\rTyp" +
|
||||
"\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\"\300\005\n\005C" +
|
||||
"lass\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.jetbrai" +
|
||||
"ns.kotlin.serialization.TypeParameter\022;\n" +
|
||||
"\tsupertype\030\006 \003(\0132(.org.jetbrains.kotlin." +
|
||||
"serialization.Type\022\030\n\014supertype_id\030\002 \003(\005" +
|
||||
"B\002\020\001\022!\n\021nested_class_name\030\007 \003(\005B\006\020\001\210\265\030\001\022",
|
||||
"D\n\013constructor\030\010 \003(\0132/.org.jetbrains.kot" +
|
||||
"lin.serialization.Constructor\022>\n\010functio" +
|
||||
"n\030\t \003(\0132,.org.jetbrains.kotlin.serializa" +
|
||||
"tion.Function\022>\n\010property\030\n \003(\0132,.org.je" +
|
||||
"tbrains.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.serializati" +
|
||||
"on.TypeTable\"x\n\004Kind\022\t\n\005CLASS\020\000\022\r\n\tINTER" +
|
||||
"FACE\020\001\022\016\n\nENUM_CLASS\020\002\022\016\n\nENUM_ENTRY\020\003\022\024" +
|
||||
"\n\020ANNOTATION_CLASS\020\004\022\n\n\006OBJECT\020\005\022\024\n\020COMP",
|
||||
"ANION_OBJECT\020\006*\005\010d\020\310\001\"\323\001\n\007Package\022>\n\010fun" +
|
||||
"ction\030\003 \003(\0132,.org.jetbrains.kotlin.seria" +
|
||||
"lization.Function\022>\n\010property\030\004 \003(\0132,.or" +
|
||||
"g.jetbrains.kotlin.serialization.Propert" +
|
||||
"y\022A\n\ntype_table\030\036 \001(\0132-.org.jetbrains.ko" +
|
||||
"tlin.serialization.TypeTable*\005\010d\020\310\001\"_\n\tT" +
|
||||
"ypeTable\0226\n\004type\030\001 \003(\0132(.org.jetbrains.k" +
|
||||
"otlin.serialization.Type\022\032\n\016first_nullab" +
|
||||
"le\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.jet",
|
||||
"brains.kotlin.serialization.ValueParamet" +
|
||||
"er*\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_type\030\003 \001(" +
|
||||
"\0132(.org.jetbrains.kotlin.serialization.T" +
|
||||
"ype\022\026\n\016return_type_id\030\007 \001(\005\022I\n\016type_para" +
|
||||
"meter\030\004 \003(\01321.org.jetbrains.kotlin.seria" +
|
||||
"lization.TypeParameter\022?\n\rreceiver_type\030" +
|
||||
"\005 \001(\0132(.org.jetbrains.kotlin.serializati" +
|
||||
"on.Type\022\030\n\020receiver_type_id\030\010 \001(\005\022K\n\017val" +
|
||||
"ue_parameter\030\006 \003(\01322.org.jetbrains.kotli",
|
||||
"n.serialization.ValueParameter\022A\n\ntype_t" +
|
||||
"able\030\036 \001(\0132-.org.jetbrains.kotlin.serial" +
|
||||
"ization.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.jetbrains.kotli" +
|
||||
"n.serialization.Type\022\026\n\016return_type_id\030\t" +
|
||||
" \001(\005\022I\n\016type_parameter\030\004 \003(\01321.org.jetbr" +
|
||||
"ains.kotlin.serialization.TypeParameter\022" +
|
||||
"?\n\rreceiver_type\030\005 \001(\0132(.org.jetbrains.k" +
|
||||
"otlin.serialization.Type\022\030\n\020receiver_typ",
|
||||
"e_id\030\n \001(\005\022R\n\026setter_value_parameter\030\006 \001" +
|
||||
"(\01322.org.jetbrains.kotlin.serialization." +
|
||||
"ValueParameter\022\024\n\014getter_flags\030\007 \001(\005\022\024\n\014" +
|
||||
"setter_flags\030\010 \001(\005*\005\010d\020\310\001\"\355\001\n\016ValueParam" +
|
||||
"eter\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\023v" +
|
||||
"ararg_element_type\030\004 \001(\0132(.org.jetbrains" +
|
||||
".kotlin.serialization.Type\022\036\n\026vararg_ele" +
|
||||
"ment_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\010ABSTRACT\020\002\022\n\n\006SEAL" +
|
||||
"ED\020\003*b\n\nVisibility\022\014\n\010INTERNAL\020\000\022\013\n\007PRIV" +
|
||||
"ATE\020\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLIC\020\003\022\023\n\017PRIV" +
|
||||
"ATE_TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nMemberKind\022\017" +
|
||||
"\n\013DECLARATION\020\000\022\021\n\rFAKE_OVERRIDE\020\001\022\016\n\nDE" +
|
||||
"LEGATION\020\002\022\017\n\013SYNTHESIZED\020\003B\022B\rDebugProt" +
|
||||
"oBuf\210\001\000"
|
||||
"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" +
|
||||
"\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"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
|
||||
+18
-2
@@ -15,6 +15,7 @@ public final class DebugBuiltInsProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.compileTimeValue);
|
||||
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.parameterAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.typeAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.typeParameterAnnotation);
|
||||
}
|
||||
public static final int CLASS_NAME_FIELD_NUMBER = 150;
|
||||
/**
|
||||
@@ -104,6 +105,17 @@ public final class DebugBuiltInsProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
|
||||
public static final int TYPE_PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.TypeParameter { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeParameter,
|
||||
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> typeParameterAnnotation = com.google.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
|
||||
|
||||
public static com.google.protobuf.Descriptors.FileDescriptor
|
||||
getDescriptor() {
|
||||
@@ -140,8 +152,11 @@ public final class DebugBuiltInsProtoBuf {
|
||||
"alization.Annotation:r\n\017type_annotation\022" +
|
||||
"(.org.jetbrains.kotlin.serialization.Typ" +
|
||||
"e\030\226\001 \003(\0132..org.jetbrains.kotlin.serializ" +
|
||||
"ation.AnnotationB\027B\025DebugBuiltInsProtoBu" +
|
||||
"f"
|
||||
"ation.Annotation:\205\001\n\031type_parameter_anno" +
|
||||
"tation\0221.org.jetbrains.kotlin.serializat" +
|
||||
"ion.TypeParameter\030\226\001 \003(\0132..org.jetbrains",
|
||||
".kotlin.serialization.AnnotationB\027B\025Debu" +
|
||||
"gBuiltInsProtoBuf"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
@@ -156,6 +171,7 @@ public final class DebugBuiltInsProtoBuf {
|
||||
compileTimeValue.internalInit(descriptor.getExtensions().get(5));
|
||||
parameterAnnotation.internalInit(descriptor.getExtensions().get(6));
|
||||
typeAnnotation.internalInit(descriptor.getExtensions().get(7));
|
||||
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(8));
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@ public final class DebugJsProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.compileTimeValue);
|
||||
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.parameterAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.typeAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.typeParameterAnnotation);
|
||||
}
|
||||
public interface ClassesOrBuilder
|
||||
extends com.google.protobuf.MessageOrBuilder {
|
||||
@@ -1880,6 +1881,17 @@ public final class DebugJsProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
|
||||
public static final int TYPE_PARAMETER_ANNOTATION_FIELD_NUMBER = 130;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.TypeParameter { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeParameter,
|
||||
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> typeParameterAnnotation = com.google.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
|
||||
private static com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_org_jetbrains_kotlin_serialization_js_Classes_descriptor;
|
||||
private static
|
||||
@@ -1933,7 +1945,11 @@ public final class DebugJsProtoBuf {
|
||||
"zation.Annotation:r\n\017type_annotation\022(.o" +
|
||||
"rg.jetbrains.kotlin.serialization.Type\030\202" +
|
||||
"\001 \003(\0132..org.jetbrains.kotlin.serializati" +
|
||||
"on.AnnotationB\021B\017DebugJsProtoBuf"
|
||||
"on.Annotation:\205\001\n\031type_parameter_annotat",
|
||||
"ion\0221.org.jetbrains.kotlin.serialization" +
|
||||
".TypeParameter\030\202\001 \003(\0132..org.jetbrains.ko" +
|
||||
"tlin.serialization.AnnotationB\021B\017DebugJs" +
|
||||
"ProtoBuf"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
@@ -1965,6 +1981,7 @@ public final class DebugJsProtoBuf {
|
||||
compileTimeValue.internalInit(descriptor.getExtensions().get(4));
|
||||
parameterAnnotation.internalInit(descriptor.getExtensions().get(5));
|
||||
typeAnnotation.internalInit(descriptor.getExtensions().get(6));
|
||||
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(7));
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@ public final class DebugJvmProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.propertyImplClassName);
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.typeAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.isRaw);
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.typeParameterAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.index);
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.classAnnotation);
|
||||
}
|
||||
@@ -4724,6 +4725,17 @@ public final class DebugJvmProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.Boolean.class,
|
||||
null);
|
||||
public static final int TYPE_PARAMETER_ANNOTATION_FIELD_NUMBER = 100;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.TypeParameter { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeParameter,
|
||||
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> typeParameterAnnotation = com.google.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
|
||||
public static final int INDEX_FIELD_NUMBER = 100;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.ValueParameter { ... }</code>
|
||||
@@ -4826,12 +4838,16 @@ public final class DebugJvmProtoBuf {
|
||||
"(.org.jetbrains.kotlin.serialization.Typ" +
|
||||
"e\030d \003(\0132..org.jetbrains.kotlin.serializa" +
|
||||
"tion.Annotation:8\n\006is_raw\022(.org.jetbrain" +
|
||||
"s.kotlin.serialization.Type\030e \001(\010:A\n\005ind" +
|
||||
"ex\0222.org.jetbrains.kotlin.serialization." +
|
||||
"ValueParameter\030d \001(\005:s\n\020class_annotation" +
|
||||
"\022).org.jetbrains.kotlin.serialization.Cl",
|
||||
"ass\030d \003(\0132..org.jetbrains.kotlin.seriali" +
|
||||
"zation.AnnotationB\022B\020DebugJvmProtoBuf"
|
||||
"s.kotlin.serialization.Type\030e \001(\010:\204\001\n\031ty" +
|
||||
"pe_parameter_annotation\0221.org.jetbrains." +
|
||||
"kotlin.serialization.TypeParameter\030d \003(\013" +
|
||||
"2..org.jetbrains.kotlin.serialization.An",
|
||||
"notation:A\n\005index\0222.org.jetbrains.kotlin" +
|
||||
".serialization.ValueParameter\030d \001(\005:s\n\020c" +
|
||||
"lass_annotation\022).org.jetbrains.kotlin.s" +
|
||||
"erialization.Class\030d \003(\0132..org.jetbrains" +
|
||||
".kotlin.serialization.AnnotationB\022B\020Debu" +
|
||||
"gJvmProtoBuf"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
@@ -4875,8 +4891,9 @@ public final class DebugJvmProtoBuf {
|
||||
propertyImplClassName.internalInit(descriptor.getExtensions().get(4));
|
||||
typeAnnotation.internalInit(descriptor.getExtensions().get(5));
|
||||
isRaw.internalInit(descriptor.getExtensions().get(6));
|
||||
index.internalInit(descriptor.getExtensions().get(7));
|
||||
classAnnotation.internalInit(descriptor.getExtensions().get(8));
|
||||
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(7));
|
||||
index.internalInit(descriptor.getExtensions().get(8));
|
||||
classAnnotation.internalInit(descriptor.getExtensions().get(9));
|
||||
com.google.protobuf.ExtensionRegistry registry =
|
||||
com.google.protobuf.ExtensionRegistry.newInstance();
|
||||
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.stringIdInTable);
|
||||
|
||||
@@ -119,6 +119,10 @@ extend Type {
|
||||
optional bool is_raw = 101;
|
||||
}
|
||||
|
||||
extend TypeParameter {
|
||||
repeated Annotation type_parameter_annotation = 100;
|
||||
}
|
||||
|
||||
extend ValueParameter {
|
||||
// Index of the corresponding parameter of this method in JVM (counting receiver parameters, enum constructor synthetic parameters, etc.)
|
||||
optional int32 index = 100;
|
||||
|
||||
+4
@@ -166,6 +166,10 @@ public abstract class AbstractBinaryClassAnnotationAndConstantLoader<A : Any, C
|
||||
return type.getExtension(JvmProtoBuf.typeAnnotation).map { loadTypeAnnotation(it, nameResolver) }
|
||||
}
|
||||
|
||||
override fun loadTypeParameterAnnotations(typeParameter: ProtoBuf.TypeParameter, nameResolver: NameResolver): List<A> {
|
||||
return typeParameter.getExtension(JvmProtoBuf.typeParameterAnnotation).map { loadTypeAnnotation(it, nameResolver) }
|
||||
}
|
||||
|
||||
override fun loadPropertyConstant(container: ProtoContainer, proto: ProtoBuf.Property, expectedType: JetType): C? {
|
||||
val nameResolver = container.nameResolver
|
||||
val signature = getCallableSignature(proto, nameResolver, container.typeTable, AnnotatedCallableKind.PROPERTY) ?: return null
|
||||
|
||||
+16
@@ -14,6 +14,7 @@ public final class JvmProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.propertyImplClassName);
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.typeAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.isRaw);
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.typeParameterAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.index);
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.classAnnotation);
|
||||
}
|
||||
@@ -3939,6 +3940,21 @@ public final class JvmProtoBuf {
|
||||
null,
|
||||
101,
|
||||
com.google.protobuf.WireFormat.FieldType.BOOL);
|
||||
public static final int TYPE_PARAMETER_ANNOTATION_FIELD_NUMBER = 100;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.TypeParameter { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter,
|
||||
java.util.List<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation>> typeParameterAnnotation = com.google.protobuf.GeneratedMessageLite
|
||||
.newRepeatedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter.getDefaultInstance(),
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.getDefaultInstance(),
|
||||
null,
|
||||
100,
|
||||
com.google.protobuf.WireFormat.FieldType.MESSAGE,
|
||||
false);
|
||||
public static final int INDEX_FIELD_NUMBER = 100;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.ValueParameter { ... }</code>
|
||||
|
||||
+4
@@ -74,6 +74,10 @@ class BuiltInsAnnotationAndConstantLoader(
|
||||
return proto.getExtension(BuiltInsProtoBuf.typeAnnotation).orEmpty().map { deserializer.deserializeAnnotation(it, nameResolver) }
|
||||
}
|
||||
|
||||
override fun loadTypeParameterAnnotations(proto: ProtoBuf.TypeParameter, nameResolver: NameResolver): List<AnnotationDescriptor> {
|
||||
return proto.getExtension(BuiltInsProtoBuf.typeParameterAnnotation).orEmpty().map { deserializer.deserializeAnnotation(it, nameResolver) }
|
||||
}
|
||||
|
||||
override fun loadPropertyConstant(
|
||||
container: ProtoContainer,
|
||||
proto: ProtoBuf.Property,
|
||||
|
||||
@@ -50,3 +50,7 @@ extend ValueParameter {
|
||||
extend Type {
|
||||
repeated Annotation type_annotation = 150;
|
||||
}
|
||||
|
||||
extend TypeParameter {
|
||||
repeated Annotation type_parameter_annotation = 150;
|
||||
}
|
||||
|
||||
@@ -148,6 +148,8 @@ message TypeParameter {
|
||||
|
||||
repeated Type upper_bound = 5;
|
||||
repeated int32 upper_bound_id = 6;
|
||||
|
||||
extensions 100 to 999;
|
||||
}
|
||||
|
||||
message Class {
|
||||
|
||||
@@ -6112,8 +6112,9 @@ public final class ProtoBuf {
|
||||
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.serialization.Type)
|
||||
}
|
||||
|
||||
public interface TypeParameterOrBuilder
|
||||
extends com.google.protobuf.MessageLiteOrBuilder {
|
||||
public interface TypeParameterOrBuilder extends
|
||||
com.google.protobuf.GeneratedMessageLite.
|
||||
ExtendableMessageOrBuilder<TypeParameter> {
|
||||
|
||||
// required int32 id = 1;
|
||||
/**
|
||||
@@ -6188,10 +6189,10 @@ public final class ProtoBuf {
|
||||
* Protobuf type {@code org.jetbrains.kotlin.serialization.TypeParameter}
|
||||
*/
|
||||
public static final class TypeParameter extends
|
||||
com.google.protobuf.GeneratedMessageLite
|
||||
implements TypeParameterOrBuilder {
|
||||
com.google.protobuf.GeneratedMessageLite.ExtendableMessage<
|
||||
TypeParameter> implements TypeParameterOrBuilder {
|
||||
// Use TypeParameter.newBuilder() to construct.
|
||||
private TypeParameter(com.google.protobuf.GeneratedMessageLite.Builder builder) {
|
||||
private TypeParameter(com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter, ?> builder) {
|
||||
super(builder);
|
||||
|
||||
}
|
||||
@@ -6528,6 +6529,10 @@ public final class ProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!extensionsAreInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
return false;
|
||||
}
|
||||
memoizedIsInitialized = 1;
|
||||
return true;
|
||||
}
|
||||
@@ -6535,6 +6540,9 @@ public final class ProtoBuf {
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
getSerializedSize();
|
||||
com.google.protobuf.GeneratedMessageLite
|
||||
.ExtendableMessage<org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter>.ExtensionWriter extensionWriter =
|
||||
newExtensionWriter();
|
||||
if (((bitField0_ & 0x00000001) == 0x00000001)) {
|
||||
output.writeInt32(1, id_);
|
||||
}
|
||||
@@ -6553,6 +6561,7 @@ public final class ProtoBuf {
|
||||
for (int i = 0; i < upperBoundId_.size(); i++) {
|
||||
output.writeInt32(6, upperBoundId_.get(i));
|
||||
}
|
||||
extensionWriter.writeUntil(1000, output);
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
@@ -6590,6 +6599,7 @@ public final class ProtoBuf {
|
||||
size += dataSize;
|
||||
size += 1 * getUpperBoundIdList().size();
|
||||
}
|
||||
size += extensionsSerializedSize();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
@@ -6665,9 +6675,8 @@ public final class ProtoBuf {
|
||||
* Protobuf type {@code org.jetbrains.kotlin.serialization.TypeParameter}
|
||||
*/
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessageLite.Builder<
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter, Builder>
|
||||
implements org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameterOrBuilder {
|
||||
com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter, Builder> implements org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameterOrBuilder {
|
||||
// Construct using org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter.newBuilder()
|
||||
private Builder() {
|
||||
maybeForceBuilderInitialization();
|
||||
@@ -6780,6 +6789,7 @@ public final class ProtoBuf {
|
||||
}
|
||||
|
||||
}
|
||||
this.mergeExtensionFields(other);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -6798,6 +6808,10 @@ public final class ProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!extensionsAreInitialized()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+16
@@ -15,6 +15,7 @@ public final class BuiltInsProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.compileTimeValue);
|
||||
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.parameterAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.typeAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.typeParameterAnnotation);
|
||||
}
|
||||
public static final int CLASS_NAME_FIELD_NUMBER = 150;
|
||||
/**
|
||||
@@ -136,6 +137,21 @@ public final class BuiltInsProtoBuf {
|
||||
150,
|
||||
com.google.protobuf.WireFormat.FieldType.MESSAGE,
|
||||
false);
|
||||
public static final int TYPE_PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.TypeParameter { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter,
|
||||
java.util.List<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation>> typeParameterAnnotation = com.google.protobuf.GeneratedMessageLite
|
||||
.newRepeatedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter.getDefaultInstance(),
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.getDefaultInstance(),
|
||||
null,
|
||||
150,
|
||||
com.google.protobuf.WireFormat.FieldType.MESSAGE,
|
||||
false);
|
||||
|
||||
static {
|
||||
}
|
||||
|
||||
+6
@@ -62,6 +62,12 @@ public interface AnnotationAndConstantLoader<A, C, T> {
|
||||
@NotNull NameResolver nameResolver
|
||||
);
|
||||
|
||||
@NotNull
|
||||
List<A> loadTypeParameterAnnotations(
|
||||
@NotNull ProtoBuf.TypeParameter typeParameter,
|
||||
@NotNull NameResolver nameResolver
|
||||
);
|
||||
|
||||
@Nullable
|
||||
C loadPropertyConstant(
|
||||
@NotNull ProtoContainer container,
|
||||
|
||||
+27
-39
@@ -14,52 +14,40 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.serialization.deserialization.descriptors;
|
||||
package org.jetbrains.kotlin.serialization.deserialization.descriptors
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.descriptors.SourceElement;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.descriptors.impl.AbstractLazyTypeParameterDescriptor;
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf;
|
||||
import org.jetbrains.kotlin.serialization.deserialization.*;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationWithTarget
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.impl.AbstractLazyTypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.deserialization.*
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
import java.util.*
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
class DeserializedTypeParameterDescriptor(
|
||||
c: DeserializationContext, private val proto: ProtoBuf.TypeParameter, index: Int) : AbstractLazyTypeParameterDescriptor(c.storageManager, c.containingDeclaration, c.nameResolver.getName(proto.name), Deserialization.variance(proto.variance), proto.reified, index, SourceElement.NO_SOURCE) {
|
||||
private val typeDeserializer: TypeDeserializer = c.typeDeserializer
|
||||
private val typeTable: TypeTable = c.typeTable
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getBuiltIns;
|
||||
|
||||
public class DeserializedTypeParameterDescriptor extends AbstractLazyTypeParameterDescriptor {
|
||||
private final ProtoBuf.TypeParameter proto;
|
||||
private final TypeDeserializer typeDeserializer;
|
||||
private final TypeTable typeTable;
|
||||
|
||||
public DeserializedTypeParameterDescriptor(@NotNull DeserializationContext c, @NotNull ProtoBuf.TypeParameter proto, int index) {
|
||||
super(c.getStorageManager(),
|
||||
c.getContainingDeclaration(),
|
||||
c.getNameResolver().getName(proto.getName()),
|
||||
Deserialization.variance(proto.getVariance()),
|
||||
proto.getReified(),
|
||||
index,
|
||||
SourceElement.NO_SOURCE);
|
||||
this.proto = proto;
|
||||
this.typeDeserializer = c.getTypeDeserializer();
|
||||
this.typeTable = c.getTypeTable();
|
||||
private val annotations = DeserializedAnnotationsWithPossibleTargets(c.storageManager) {
|
||||
c.components.annotationAndConstantLoader
|
||||
.loadTypeParameterAnnotations(proto, c.nameResolver)
|
||||
.map { AnnotationWithTarget(it, null) }
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Set<JetType> resolveUpperBounds() {
|
||||
List<ProtoBuf.Type> upperBounds = ProtoTypeTableUtilKt.upperBounds(proto, typeTable);
|
||||
override fun getAnnotations(): Annotations = annotations
|
||||
|
||||
override fun resolveUpperBounds(): Set<JetType> {
|
||||
val upperBounds = proto.upperBounds(typeTable)
|
||||
if (upperBounds.isEmpty()) {
|
||||
return Collections.singleton(getBuiltIns(this).getDefaultBound());
|
||||
return setOf(this.builtIns.getDefaultBound())
|
||||
}
|
||||
Set<JetType> result = new LinkedHashSet<JetType>(upperBounds.size());
|
||||
for (ProtoBuf.Type upperBound : upperBounds) {
|
||||
result.add(typeDeserializer.type(upperBound, Annotations.Companion.getEMPTY()));
|
||||
val result = LinkedHashSet<JetType>(upperBounds.size())
|
||||
for (upperBound in upperBounds) {
|
||||
result.add(typeDeserializer.type(upperBound, Annotations.EMPTY))
|
||||
}
|
||||
return result;
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -73,6 +73,9 @@ public class AnnotationLoaderForKotlinJavaScriptStubBuilder() : AnnotationAndCon
|
||||
): List<ClassId> =
|
||||
proto.getExtension(JsProtoBuf.typeAnnotation).orEmpty().map { nameResolver.getClassId(it.id) }
|
||||
|
||||
override fun loadTypeParameterAnnotations(proto: ProtoBuf.TypeParameter, nameResolver: NameResolver): List<ClassId> =
|
||||
proto.getExtension(JsProtoBuf.typeParameterAnnotation).orEmpty().map { nameResolver.getClassId(it.id) }
|
||||
|
||||
override fun loadPropertyConstant(
|
||||
container: ProtoContainer,
|
||||
proto: ProtoBuf.Property,
|
||||
|
||||
@@ -467,6 +467,18 @@ public class ResolveByStubTestGenerated extends AbstractResolveByStubTest {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeAnnotationWithArguments.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeParameterAnnotation.kt")
|
||||
public void testTypeParameterAnnotation() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeParameterAnnotation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeParameterAnnotationWithArguments.kt")
|
||||
public void testTypeParameterAnnotationWithArguments() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeParameterAnnotationWithArguments.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledKotlin/annotations/withUseSiteTarget")
|
||||
|
||||
@@ -308,6 +308,12 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
||||
|
||||
if (!checkEqualsTypeParameterUpperBoundId(old, new)) return false
|
||||
|
||||
if (old.getExtensionCount(JvmProtoBuf.typeParameterAnnotation) != new.getExtensionCount(JvmProtoBuf.typeParameterAnnotation)) return false
|
||||
|
||||
for(i in 0..old.getExtensionCount(JvmProtoBuf.typeParameterAnnotation) - 1) {
|
||||
if (!checkEquals(old.getExtension(JvmProtoBuf.typeParameterAnnotation, i), new.getExtension(JvmProtoBuf.typeParameterAnnotation, i))) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -995,6 +1001,10 @@ public fun ProtoBuf.TypeParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIn
|
||||
hashCode = 31 * hashCode + getUpperBoundId(i)
|
||||
}
|
||||
|
||||
for(i in 0..getExtensionCount(JvmProtoBuf.typeParameterAnnotation) - 1) {
|
||||
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.typeParameterAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
return hashCode
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,10 @@ extend Type {
|
||||
repeated Annotation type_annotation = 130;
|
||||
}
|
||||
|
||||
extend TypeParameter {
|
||||
repeated Annotation type_parameter_annotation = 130;
|
||||
}
|
||||
|
||||
message Classes {
|
||||
// id in StringTable
|
||||
repeated int32 class_name = 1 [packed = true];
|
||||
|
||||
@@ -14,6 +14,7 @@ public final class JsProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.compileTimeValue);
|
||||
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.parameterAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.typeAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.typeParameterAnnotation);
|
||||
}
|
||||
public interface ClassesOrBuilder
|
||||
extends com.google.protobuf.MessageLiteOrBuilder {
|
||||
@@ -1569,6 +1570,21 @@ public final class JsProtoBuf {
|
||||
130,
|
||||
com.google.protobuf.WireFormat.FieldType.MESSAGE,
|
||||
false);
|
||||
public static final int TYPE_PARAMETER_ANNOTATION_FIELD_NUMBER = 130;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.TypeParameter { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter,
|
||||
java.util.List<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation>> typeParameterAnnotation = com.google.protobuf.GeneratedMessageLite
|
||||
.newRepeatedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter.getDefaultInstance(),
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.getDefaultInstance(),
|
||||
null,
|
||||
130,
|
||||
com.google.protobuf.WireFormat.FieldType.MESSAGE,
|
||||
false);
|
||||
|
||||
static {
|
||||
}
|
||||
|
||||
+5
@@ -74,6 +74,11 @@ class KotlinJavascriptAnnotationAndConstantLoader(
|
||||
return annotations.map { proto -> deserializer.deserializeAnnotation(proto, nameResolver) }
|
||||
}
|
||||
|
||||
override fun loadTypeParameterAnnotations(proto: ProtoBuf.TypeParameter, nameResolver: NameResolver): List<AnnotationDescriptor> {
|
||||
val annotations = proto.getExtension(JsProtoBuf.typeParameterAnnotation).orEmpty()
|
||||
return annotations.map { proto -> deserializer.deserializeAnnotation(proto, nameResolver) }
|
||||
}
|
||||
|
||||
override fun loadPropertyConstant(
|
||||
container: ProtoContainer,
|
||||
proto: ProtoBuf.Property,
|
||||
|
||||
Reference in New Issue
Block a user