diff --git a/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt b/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt
index 4ab9cffccb8..7ae072e1a80 100644
--- a/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt
+++ b/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt
@@ -327,6 +327,8 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.expandedTypeId != new.expandedTypeId) return false
}
+ if (!checkEqualsTypeAliasAnnotation(old, new)) return false
+
return true
}
@@ -795,6 +797,16 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
return true
}
+ open fun checkEqualsTypeAliasAnnotation(old: ProtoBuf.TypeAlias, new: ProtoBuf.TypeAlias): Boolean {
+ if (old.annotationCount != new.annotationCount) return false
+
+ for(i in 0..old.annotationCount - 1) {
+ if (!checkEquals(old.getAnnotation(i), new.getAnnotation(i))) return false
+ }
+
+ return true
+ }
+
open fun checkEqualsTypeTableType(old: ProtoBuf.TypeTable, new: ProtoBuf.TypeTable): Boolean {
if (old.typeCount != new.typeCount) return false
@@ -1111,6 +1123,10 @@ fun ProtoBuf.TypeAlias.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int
hashCode = 31 * hashCode + expandedTypeId
}
+ for(i in 0..annotationCount - 1) {
+ hashCode = 31 * hashCode + getAnnotation(i).hashCode(stringIndexes, fqNameIndexes)
+ }
+
return hashCode
}
diff --git a/build-common/test/org/jetbrains/kotlin/serialization/DebugProtoBuf.java b/build-common/test/org/jetbrains/kotlin/serialization/DebugProtoBuf.java
index 0415409a6b9..5390fc8e15b 100644
--- a/build-common/test/org/jetbrains/kotlin/serialization/DebugProtoBuf.java
+++ b/build-common/test/org/jetbrains/kotlin/serialization/DebugProtoBuf.java
@@ -22266,6 +22266,30 @@ public final class DebugProtoBuf {
* optional int32 expanded_type_id = 7;
*/
int getExpandedTypeId();
+
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ java.util.List
+ getAnnotationList();
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation getAnnotation(int index);
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ int getAnnotationCount();
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ java.util.List extends org.jetbrains.kotlin.serialization.DebugProtoBuf.AnnotationOrBuilder>
+ getAnnotationOrBuilderList();
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ org.jetbrains.kotlin.serialization.DebugProtoBuf.AnnotationOrBuilder getAnnotationOrBuilder(
+ int index);
}
/**
* Protobuf type {@code org.jetbrains.kotlin.serialization.TypeAlias}
@@ -22374,6 +22398,14 @@ public final class DebugProtoBuf {
expandedTypeId_ = input.readInt32();
break;
}
+ case 66: {
+ if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
+ annotation_ = new java.util.ArrayList();
+ mutable_bitField0_ |= 0x00000080;
+ }
+ annotation_.add(input.readMessage(org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.PARSER, extensionRegistry));
+ break;
+ }
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -22385,6 +22417,9 @@ public final class DebugProtoBuf {
if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
typeParameter_ = java.util.Collections.unmodifiableList(typeParameter_);
}
+ if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
+ annotation_ = java.util.Collections.unmodifiableList(annotation_);
+ }
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
@@ -22564,6 +22599,41 @@ public final class DebugProtoBuf {
return expandedTypeId_;
}
+ public static final int ANNOTATION_FIELD_NUMBER = 8;
+ private java.util.List annotation_;
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public java.util.List getAnnotationList() {
+ return annotation_;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public java.util.List extends org.jetbrains.kotlin.serialization.DebugProtoBuf.AnnotationOrBuilder>
+ getAnnotationOrBuilderList() {
+ return annotation_;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public int getAnnotationCount() {
+ return annotation_.size();
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation getAnnotation(int index) {
+ return annotation_.get(index);
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public org.jetbrains.kotlin.serialization.DebugProtoBuf.AnnotationOrBuilder getAnnotationOrBuilder(
+ int index) {
+ return annotation_.get(index);
+ }
+
private void initFields() {
flags_ = 0;
name_ = 0;
@@ -22572,6 +22642,7 @@ public final class DebugProtoBuf {
underlyingTypeId_ = 0;
expandedType_ = org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.getDefaultInstance();
expandedTypeId_ = 0;
+ annotation_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -22601,6 +22672,12 @@ public final class DebugProtoBuf {
return false;
}
}
+ for (int i = 0; i < getAnnotationCount(); i++) {
+ if (!getAnnotation(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
if (!extensionsAreInitialized()) {
memoizedIsInitialized = 0;
return false;
@@ -22636,6 +22713,9 @@ public final class DebugProtoBuf {
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeInt32(7, expandedTypeId_);
}
+ for (int i = 0; i < annotation_.size(); i++) {
+ output.writeMessage(8, annotation_.get(i));
+ }
extensionWriter.writeUntil(200, output);
getUnknownFields().writeTo(output);
}
@@ -22674,6 +22754,10 @@ public final class DebugProtoBuf {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(7, expandedTypeId_);
}
+ for (int i = 0; i < annotation_.size(); i++) {
+ size += org.jetbrains.kotlin.protobuf.CodedOutputStream
+ .computeMessageSize(8, annotation_.get(i));
+ }
size += extensionsSerializedSize();
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
@@ -22788,6 +22872,7 @@ public final class DebugProtoBuf {
getTypeParameterFieldBuilder();
getUnderlyingTypeFieldBuilder();
getExpandedTypeFieldBuilder();
+ getAnnotationFieldBuilder();
}
}
private static Builder create() {
@@ -22822,6 +22907,12 @@ public final class DebugProtoBuf {
bitField0_ = (bitField0_ & ~0x00000020);
expandedTypeId_ = 0;
bitField0_ = (bitField0_ & ~0x00000040);
+ if (annotationBuilder_ == null) {
+ annotation_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000080);
+ } else {
+ annotationBuilder_.clear();
+ }
return this;
}
@@ -22891,6 +22982,15 @@ public final class DebugProtoBuf {
to_bitField0_ |= 0x00000020;
}
result.expandedTypeId_ = expandedTypeId_;
+ if (annotationBuilder_ == null) {
+ if (((bitField0_ & 0x00000080) == 0x00000080)) {
+ annotation_ = java.util.Collections.unmodifiableList(annotation_);
+ bitField0_ = (bitField0_ & ~0x00000080);
+ }
+ result.annotation_ = annotation_;
+ } else {
+ result.annotation_ = annotationBuilder_.build();
+ }
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
@@ -22951,6 +23051,32 @@ public final class DebugProtoBuf {
if (other.hasExpandedTypeId()) {
setExpandedTypeId(other.getExpandedTypeId());
}
+ if (annotationBuilder_ == null) {
+ if (!other.annotation_.isEmpty()) {
+ if (annotation_.isEmpty()) {
+ annotation_ = other.annotation_;
+ bitField0_ = (bitField0_ & ~0x00000080);
+ } else {
+ ensureAnnotationIsMutable();
+ annotation_.addAll(other.annotation_);
+ }
+ onChanged();
+ }
+ } else {
+ if (!other.annotation_.isEmpty()) {
+ if (annotationBuilder_.isEmpty()) {
+ annotationBuilder_.dispose();
+ annotationBuilder_ = null;
+ annotation_ = other.annotation_;
+ bitField0_ = (bitField0_ & ~0x00000080);
+ annotationBuilder_ =
+ org.jetbrains.kotlin.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+ getAnnotationFieldBuilder() : null;
+ } else {
+ annotationBuilder_.addAllMessages(other.annotation_);
+ }
+ }
+ }
this.mergeExtensionFields(other);
this.mergeUnknownFields(other.getUnknownFields());
return this;
@@ -22979,6 +23105,12 @@ public final class DebugProtoBuf {
return false;
}
}
+ for (int i = 0; i < getAnnotationCount(); i++) {
+ if (!getAnnotation(i).isInitialized()) {
+
+ return false;
+ }
+ }
if (!extensionsAreInitialized()) {
return false;
@@ -23625,6 +23757,246 @@ public final class DebugProtoBuf {
return this;
}
+ private java.util.List annotation_ =
+ java.util.Collections.emptyList();
+ private void ensureAnnotationIsMutable() {
+ if (!((bitField0_ & 0x00000080) == 0x00000080)) {
+ annotation_ = new java.util.ArrayList(annotation_);
+ bitField0_ |= 0x00000080;
+ }
+ }
+
+ private org.jetbrains.kotlin.protobuf.RepeatedFieldBuilder<
+ org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation, org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Builder, org.jetbrains.kotlin.serialization.DebugProtoBuf.AnnotationOrBuilder> annotationBuilder_;
+
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public java.util.List getAnnotationList() {
+ if (annotationBuilder_ == null) {
+ return java.util.Collections.unmodifiableList(annotation_);
+ } else {
+ return annotationBuilder_.getMessageList();
+ }
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public int getAnnotationCount() {
+ if (annotationBuilder_ == null) {
+ return annotation_.size();
+ } else {
+ return annotationBuilder_.getCount();
+ }
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation getAnnotation(int index) {
+ if (annotationBuilder_ == null) {
+ return annotation_.get(index);
+ } else {
+ return annotationBuilder_.getMessage(index);
+ }
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder setAnnotation(
+ int index, org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation value) {
+ if (annotationBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureAnnotationIsMutable();
+ annotation_.set(index, value);
+ onChanged();
+ } else {
+ annotationBuilder_.setMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder setAnnotation(
+ int index, org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Builder builderForValue) {
+ if (annotationBuilder_ == null) {
+ ensureAnnotationIsMutable();
+ annotation_.set(index, builderForValue.build());
+ onChanged();
+ } else {
+ annotationBuilder_.setMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder addAnnotation(org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation value) {
+ if (annotationBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureAnnotationIsMutable();
+ annotation_.add(value);
+ onChanged();
+ } else {
+ annotationBuilder_.addMessage(value);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder addAnnotation(
+ int index, org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation value) {
+ if (annotationBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureAnnotationIsMutable();
+ annotation_.add(index, value);
+ onChanged();
+ } else {
+ annotationBuilder_.addMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder addAnnotation(
+ org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Builder builderForValue) {
+ if (annotationBuilder_ == null) {
+ ensureAnnotationIsMutable();
+ annotation_.add(builderForValue.build());
+ onChanged();
+ } else {
+ annotationBuilder_.addMessage(builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder addAnnotation(
+ int index, org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Builder builderForValue) {
+ if (annotationBuilder_ == null) {
+ ensureAnnotationIsMutable();
+ annotation_.add(index, builderForValue.build());
+ onChanged();
+ } else {
+ annotationBuilder_.addMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder addAllAnnotation(
+ java.lang.Iterable extends org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation> values) {
+ if (annotationBuilder_ == null) {
+ ensureAnnotationIsMutable();
+ org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
+ values, annotation_);
+ onChanged();
+ } else {
+ annotationBuilder_.addAllMessages(values);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder clearAnnotation() {
+ if (annotationBuilder_ == null) {
+ annotation_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000080);
+ onChanged();
+ } else {
+ annotationBuilder_.clear();
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder removeAnnotation(int index) {
+ if (annotationBuilder_ == null) {
+ ensureAnnotationIsMutable();
+ annotation_.remove(index);
+ onChanged();
+ } else {
+ annotationBuilder_.remove(index);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Builder getAnnotationBuilder(
+ int index) {
+ return getAnnotationFieldBuilder().getBuilder(index);
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public org.jetbrains.kotlin.serialization.DebugProtoBuf.AnnotationOrBuilder getAnnotationOrBuilder(
+ int index) {
+ if (annotationBuilder_ == null) {
+ return annotation_.get(index); } else {
+ return annotationBuilder_.getMessageOrBuilder(index);
+ }
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public java.util.List extends org.jetbrains.kotlin.serialization.DebugProtoBuf.AnnotationOrBuilder>
+ getAnnotationOrBuilderList() {
+ if (annotationBuilder_ != null) {
+ return annotationBuilder_.getMessageOrBuilderList();
+ } else {
+ return java.util.Collections.unmodifiableList(annotation_);
+ }
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Builder addAnnotationBuilder() {
+ return getAnnotationFieldBuilder().addBuilder(
+ org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Builder addAnnotationBuilder(
+ int index) {
+ return getAnnotationFieldBuilder().addBuilder(
+ index, org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public java.util.List
+ getAnnotationBuilderList() {
+ return getAnnotationFieldBuilder().getBuilderList();
+ }
+ private org.jetbrains.kotlin.protobuf.RepeatedFieldBuilder<
+ org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation, org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Builder, org.jetbrains.kotlin.serialization.DebugProtoBuf.AnnotationOrBuilder>
+ getAnnotationFieldBuilder() {
+ if (annotationBuilder_ == null) {
+ annotationBuilder_ = new org.jetbrains.kotlin.protobuf.RepeatedFieldBuilder<
+ org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation, org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Builder, org.jetbrains.kotlin.serialization.DebugProtoBuf.AnnotationOrBuilder>(
+ annotation_,
+ ((bitField0_ & 0x00000080) == 0x00000080),
+ getParentForChildren(),
+ isClean());
+ annotation_ = null;
+ }
+ return annotationBuilder_;
+ }
+
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.TypeAlias)
}
@@ -24269,7 +24641,7 @@ public final class DebugProtoBuf {
"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\"\275\002\n\tTypeAlias\022" +
+ "ment_type_id\030\006 \001(\005*\005\010d\020\310\001\"\201\003\n\tTypeAlias\022" +
"\020\n\005flags\030\001 \001(\005:\0010\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022I\n" +
"\016type_parameter\030\003 \003(\01321.org.jetbrains.ko" +
"tlin.serialization.TypeParameter\022A\n\017unde" +
@@ -24277,15 +24649,16 @@ public final class DebugProtoBuf {
".serialization.Type\022\032\n\022underlying_type_i" +
"d\030\005 \001(\005\022?\n\rexpanded_type\030\006 \001(\0132(.org.jet" +
"brains.kotlin.serialization.Type\022\030\n\020expa" +
- "nded_type_id\030\007 \001(\005*\005\010d\020\310\001\"&\n\tEnumEntry\022\022" +
- "\n\004name\030\001 \001(\005B\004\210\265\030\001*\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\017B\rDebugProt" +
- "oBuf"
+ "nded_type_id\030\007 \001(\005\022B\n\nannotation\030\010 \003(\0132." +
+ ".org.jetbrains.kotlin.serialization.Anno",
+ "tation*\005\010d\020\310\001\"&\n\tEnumEntry\022\022\n\004name\030\001 \001(\005" +
+ "B\004\210\265\030\001*\005\010d\020\310\001*9\n\010Modality\022\t\n\005FINAL\020\000\022\010\n\004" +
+ "OPEN\020\001\022\014\n\010ABSTRACT\020\002\022\n\n\006SEALED\020\003*b\n\nVisi" +
+ "bility\022\014\n\010INTERNAL\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPRO" +
+ "TECTED\020\002\022\n\n\006PUBLIC\020\003\022\023\n\017PRIVATE_TO_THIS\020" +
+ "\004\022\t\n\005LOCAL\020\005*Q\n\nMemberKind\022\017\n\013DECLARATIO" +
+ "N\020\000\022\021\n\rFAKE_OVERRIDE\020\001\022\016\n\nDELEGATION\020\002\022\017" +
+ "\n\013SYNTHESIZED\020\003B\017B\rDebugProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -24401,7 +24774,7 @@ public final class DebugProtoBuf {
internal_static_org_jetbrains_kotlin_serialization_TypeAlias_fieldAccessorTable = new
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jetbrains_kotlin_serialization_TypeAlias_descriptor,
- new java.lang.String[] { "Flags", "Name", "TypeParameter", "UnderlyingType", "UnderlyingTypeId", "ExpandedType", "ExpandedTypeId", });
+ new java.lang.String[] { "Flags", "Name", "TypeParameter", "UnderlyingType", "UnderlyingTypeId", "ExpandedType", "ExpandedTypeId", "Annotation", });
internal_static_org_jetbrains_kotlin_serialization_EnumEntry_descriptor =
getDescriptor().getMessageTypes().get(13);
internal_static_org_jetbrains_kotlin_serialization_EnumEntry_fieldAccessorTable = new
diff --git a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt
index e0cda7e89c6..209056cc6c8 100644
--- a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt
+++ b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt
@@ -306,6 +306,8 @@ class DescriptorSerializer private constructor(
builder.setExpandedType(local.type(expandedType))
}
+ builder.addAllAnnotation(descriptor.annotations.map { extension.annotationSerializer.serializeAnnotation(it) })
+
return builder
}
diff --git a/compiler/serialization/src/org/jetbrains/kotlin/serialization/SerializerExtension.kt b/compiler/serialization/src/org/jetbrains/kotlin/serialization/SerializerExtension.kt
index 185009a5e31..5f38b48d0f0 100644
--- a/compiler/serialization/src/org/jetbrains/kotlin/serialization/SerializerExtension.kt
+++ b/compiler/serialization/src/org/jetbrains/kotlin/serialization/SerializerExtension.kt
@@ -23,6 +23,8 @@ import org.jetbrains.kotlin.types.KotlinType
abstract class SerializerExtension {
abstract val stringTable: StringTable
+ val annotationSerializer by lazy { AnnotationSerializer(stringTable) }
+
open fun shouldUseTypeTable(): Boolean = false
open fun serializeClass(descriptor: ClassDescriptor, proto: ProtoBuf.Class.Builder) {
diff --git a/compiler/serialization/src/org/jetbrains/kotlin/serialization/SerializerExtensionBase.kt b/compiler/serialization/src/org/jetbrains/kotlin/serialization/SerializerExtensionBase.kt
index 66d51f77f1b..c9de3028e13 100644
--- a/compiler/serialization/src/org/jetbrains/kotlin/serialization/SerializerExtensionBase.kt
+++ b/compiler/serialization/src/org/jetbrains/kotlin/serialization/SerializerExtensionBase.kt
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.types.KotlinType
open class KotlinSerializerExtensionBase(private val protocol: SerializerExtensionProtocol) : SerializerExtension() {
override final val stringTable = StringTableImpl()
- private val annotationSerializer = AnnotationSerializer(stringTable)
override fun serializeClass(descriptor: ClassDescriptor, proto: ProtoBuf.Class.Builder) {
for (annotation in descriptor.annotations) {
diff --git a/compiler/testData/loadJava/compiledKotlin/typealias/Annotations.kt b/compiler/testData/loadJava/compiledKotlin/typealias/Annotations.kt
new file mode 100644
index 00000000000..44369ce5fc1
--- /dev/null
+++ b/compiler/testData/loadJava/compiledKotlin/typealias/Annotations.kt
@@ -0,0 +1,9 @@
+//ALLOW_AST_ACCESS
+package test
+
+annotation class Ann(val value: String = "")
+
+@Ann()
+typealias A1 = String
+@Ann("OK")
+typealias A2 = String
diff --git a/compiler/testData/loadJava/compiledKotlin/typealias/Annotations.txt b/compiler/testData/loadJava/compiledKotlin/typealias/Annotations.txt
new file mode 100644
index 00000000000..6c5524ac0d3
--- /dev/null
+++ b/compiler/testData/loadJava/compiledKotlin/typealias/Annotations.txt
@@ -0,0 +1,10 @@
+package test
+
+@test.Ann() public typealias A1 = kotlin.String
+@test.Ann(value = "OK") public typealias A2 = kotlin.String
+
+public final annotation class Ann : kotlin.Annotation {
+ /*primary*/ public constructor Ann(/*0*/ value: kotlin.String = ...)
+ public final val value: kotlin.String
+ public final fun (): kotlin.String
+}
diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java
index 6822eb07402..79c41387bab 100644
--- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java
+++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java
@@ -4819,6 +4819,12 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava/compiledKotlin/typealias"), Pattern.compile("^(.+)\\.kt$"), true);
}
+ @TestMetadata("Annotations.kt")
+ public void testAnnotations() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/typealias/Annotations.kt");
+ doTestCompiledKotlin(fileName);
+ }
+
@TestMetadata("Basic.kt")
public void testBasic() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/typealias/Basic.kt");
diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java
index 90cea17f8df..3a35db1f052 100644
--- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java
+++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadKotlinWithTypeTableTestGenerated.java
@@ -3052,6 +3052,12 @@ public class LoadKotlinWithTypeTableTestGenerated extends AbstractLoadKotlinWith
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava/compiledKotlin/typealias"), Pattern.compile("^(.+)\\.kt$"), true);
}
+ @TestMetadata("Annotations.kt")
+ public void testAnnotations() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/typealias/Annotations.kt");
+ doTest(fileName);
+ }
+
@TestMetadata("Basic.kt")
public void testBasic() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/typealias/Basic.kt");
diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java
index 4c33607f2ff..4599cfe0f1b 100644
--- a/compiler/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java
+++ b/compiler/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java
@@ -3054,6 +3054,12 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava/compiledKotlin/typealias"), Pattern.compile("^(.+)\\.kt$"), true);
}
+ @TestMetadata("Annotations.kt")
+ public void testAnnotations() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/typealias/Annotations.kt");
+ doTest(fileName);
+ }
+
@TestMetadata("Basic.kt")
public void testBasic() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/typealias/Basic.kt");
diff --git a/core/deserialization/src/descriptors.proto b/core/deserialization/src/descriptors.proto
index bac4337c95f..3ed5fa3536c 100644
--- a/core/deserialization/src/descriptors.proto
+++ b/core/deserialization/src/descriptors.proto
@@ -348,6 +348,8 @@ message TypeAlias {
optional Type expanded_type = 6;
optional int32 expanded_type_id = 7;
+ repeated Annotation annotation = 8;
+
extensions 100 to 199;
}
diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/ProtoBuf.java b/core/deserialization/src/org/jetbrains/kotlin/serialization/ProtoBuf.java
index bfa622fa866..7255e23f183 100644
--- a/core/deserialization/src/org/jetbrains/kotlin/serialization/ProtoBuf.java
+++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/ProtoBuf.java
@@ -17088,6 +17088,20 @@ public final class ProtoBuf {
* optional int32 expanded_type_id = 7;
*/
int getExpandedTypeId();
+
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ java.util.List
+ getAnnotationList();
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ org.jetbrains.kotlin.serialization.ProtoBuf.Annotation getAnnotation(int index);
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ int getAnnotationCount();
}
/**
* Protobuf type {@code org.jetbrains.kotlin.serialization.TypeAlias}
@@ -17194,6 +17208,14 @@ public final class ProtoBuf {
expandedTypeId_ = input.readInt32();
break;
}
+ case 66: {
+ if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
+ annotation_ = new java.util.ArrayList();
+ mutable_bitField0_ |= 0x00000080;
+ }
+ annotation_.add(input.readMessage(org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.PARSER, extensionRegistry));
+ break;
+ }
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -17205,6 +17227,9 @@ public final class ProtoBuf {
if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
typeParameter_ = java.util.Collections.unmodifiableList(typeParameter_);
}
+ if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
+ annotation_ = java.util.Collections.unmodifiableList(annotation_);
+ }
try {
unknownFieldsCodedOutput.flush();
} catch (java.io.IOException e) {
@@ -17366,6 +17391,41 @@ public final class ProtoBuf {
return expandedTypeId_;
}
+ public static final int ANNOTATION_FIELD_NUMBER = 8;
+ private java.util.List annotation_;
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public java.util.List getAnnotationList() {
+ return annotation_;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public java.util.List extends org.jetbrains.kotlin.serialization.ProtoBuf.AnnotationOrBuilder>
+ getAnnotationOrBuilderList() {
+ return annotation_;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public int getAnnotationCount() {
+ return annotation_.size();
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public org.jetbrains.kotlin.serialization.ProtoBuf.Annotation getAnnotation(int index) {
+ return annotation_.get(index);
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public org.jetbrains.kotlin.serialization.ProtoBuf.AnnotationOrBuilder getAnnotationOrBuilder(
+ int index) {
+ return annotation_.get(index);
+ }
+
private void initFields() {
flags_ = 0;
name_ = 0;
@@ -17374,6 +17434,7 @@ public final class ProtoBuf {
underlyingTypeId_ = 0;
expandedType_ = org.jetbrains.kotlin.serialization.ProtoBuf.Type.getDefaultInstance();
expandedTypeId_ = 0;
+ annotation_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -17403,6 +17464,12 @@ public final class ProtoBuf {
return false;
}
}
+ for (int i = 0; i < getAnnotationCount(); i++) {
+ if (!getAnnotation(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
if (!extensionsAreInitialized()) {
memoizedIsInitialized = 0;
return false;
@@ -17438,6 +17505,9 @@ public final class ProtoBuf {
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeInt32(7, expandedTypeId_);
}
+ for (int i = 0; i < annotation_.size(); i++) {
+ output.writeMessage(8, annotation_.get(i));
+ }
extensionWriter.writeUntil(200, output);
output.writeRawBytes(unknownFields);
}
@@ -17476,6 +17546,10 @@ public final class ProtoBuf {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(7, expandedTypeId_);
}
+ for (int i = 0; i < annotation_.size(); i++) {
+ size += org.jetbrains.kotlin.protobuf.CodedOutputStream
+ .computeMessageSize(8, annotation_.get(i));
+ }
size += extensionsSerializedSize();
size += unknownFields.size();
memoizedSerializedSize = size;
@@ -17584,6 +17658,8 @@ public final class ProtoBuf {
bitField0_ = (bitField0_ & ~0x00000020);
expandedTypeId_ = 0;
bitField0_ = (bitField0_ & ~0x00000040);
+ annotation_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000080);
return this;
}
@@ -17636,6 +17712,11 @@ public final class ProtoBuf {
to_bitField0_ |= 0x00000020;
}
result.expandedTypeId_ = expandedTypeId_;
+ if (((bitField0_ & 0x00000080) == 0x00000080)) {
+ annotation_ = java.util.Collections.unmodifiableList(annotation_);
+ bitField0_ = (bitField0_ & ~0x00000080);
+ }
+ result.annotation_ = annotation_;
result.bitField0_ = to_bitField0_;
return result;
}
@@ -17670,6 +17751,16 @@ public final class ProtoBuf {
if (other.hasExpandedTypeId()) {
setExpandedTypeId(other.getExpandedTypeId());
}
+ if (!other.annotation_.isEmpty()) {
+ if (annotation_.isEmpty()) {
+ annotation_ = other.annotation_;
+ bitField0_ = (bitField0_ & ~0x00000080);
+ } else {
+ ensureAnnotationIsMutable();
+ annotation_.addAll(other.annotation_);
+ }
+
+ }
this.mergeExtensionFields(other);
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
@@ -17699,6 +17790,12 @@ public final class ProtoBuf {
return false;
}
}
+ for (int i = 0; i < getAnnotationCount(); i++) {
+ if (!getAnnotation(i).isInitialized()) {
+
+ return false;
+ }
+ }
if (!extensionsAreInitialized()) {
return false;
@@ -18118,6 +18215,131 @@ public final class ProtoBuf {
return this;
}
+ private java.util.List annotation_ =
+ java.util.Collections.emptyList();
+ private void ensureAnnotationIsMutable() {
+ if (!((bitField0_ & 0x00000080) == 0x00000080)) {
+ annotation_ = new java.util.ArrayList(annotation_);
+ bitField0_ |= 0x00000080;
+ }
+ }
+
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public java.util.List getAnnotationList() {
+ return java.util.Collections.unmodifiableList(annotation_);
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public int getAnnotationCount() {
+ return annotation_.size();
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public org.jetbrains.kotlin.serialization.ProtoBuf.Annotation getAnnotation(int index) {
+ return annotation_.get(index);
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder setAnnotation(
+ int index, org.jetbrains.kotlin.serialization.ProtoBuf.Annotation value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureAnnotationIsMutable();
+ annotation_.set(index, value);
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder setAnnotation(
+ int index, org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Builder builderForValue) {
+ ensureAnnotationIsMutable();
+ annotation_.set(index, builderForValue.build());
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder addAnnotation(org.jetbrains.kotlin.serialization.ProtoBuf.Annotation value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureAnnotationIsMutable();
+ annotation_.add(value);
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder addAnnotation(
+ int index, org.jetbrains.kotlin.serialization.ProtoBuf.Annotation value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureAnnotationIsMutable();
+ annotation_.add(index, value);
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder addAnnotation(
+ org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Builder builderForValue) {
+ ensureAnnotationIsMutable();
+ annotation_.add(builderForValue.build());
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder addAnnotation(
+ int index, org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Builder builderForValue) {
+ ensureAnnotationIsMutable();
+ annotation_.add(index, builderForValue.build());
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder addAllAnnotation(
+ java.lang.Iterable extends org.jetbrains.kotlin.serialization.ProtoBuf.Annotation> values) {
+ ensureAnnotationIsMutable();
+ org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
+ values, annotation_);
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder clearAnnotation() {
+ annotation_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000080);
+
+ return this;
+ }
+ /**
+ * repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 8;
+ */
+ public Builder removeAnnotation(int index) {
+ ensureAnnotationIsMutable();
+ annotation_.remove(index);
+
+ return this;
+ }
+
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.TypeAlias)
}
diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt
index 41945f2c8e5..490c404ffd9 100644
--- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt
+++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
import org.jetbrains.kotlin.descriptors.annotations.AnnotationWithTarget
import org.jetbrains.kotlin.descriptors.annotations.Annotations
+import org.jetbrains.kotlin.descriptors.annotations.AnnotationsImpl
import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
@@ -31,6 +32,7 @@ import org.jetbrains.kotlin.serialization.deserialization.descriptors.*
import org.jetbrains.kotlin.utils.toReadOnlyList
class MemberDeserializer(private val c: DeserializationContext) {
+ private val annotationDeserializer = AnnotationDeserializer(c.components.moduleDescriptor, c.components.notFoundClasses)
fun loadProperty(proto: ProtoBuf.Property): PropertyDescriptor {
val flags = if (proto.hasFlags()) proto.flags else loadOldFlags(proto.oldFlags)
@@ -173,7 +175,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
}
fun loadTypeAlias(proto: ProtoBuf.TypeAlias): TypeAliasDescriptor {
- val annotations = Annotations.EMPTY // TODO generate & load type alias annotations
+ val annotations = AnnotationsImpl(proto.annotationList.map { annotationDeserializer.deserializeAnnotation(it, c.nameResolver) })
val visibility = Deserialization.visibility(Flags.VISIBILITY.get(proto.flags))
val typeAlias = DeserializedTypeAliasDescriptor(
diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/typeAliasClsStubBuilding.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/typeAliasClsStubBuilding.kt
index 36bad31040b..6af9a7d69ee 100644
--- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/typeAliasClsStubBuilding.kt
+++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/typeAliasClsStubBuilding.kt
@@ -18,15 +18,12 @@ package org.jetbrains.kotlin.idea.decompiler.stubBuilder
import com.intellij.psi.PsiElement
import com.intellij.psi.stubs.StubElement
-import org.jetbrains.kotlin.descriptors.SourceElement
import org.jetbrains.kotlin.idea.decompiler.stubBuilder.flags.VISIBILITY
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.psi.stubs.impl.KotlinTypeAliasStubImpl
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf
-import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.deserialization.ProtoContainer
-import org.jetbrains.kotlin.serialization.deserialization.TypeTable
fun createTypeAliasStub(
parent: StubElement,
@@ -46,7 +43,7 @@ fun createTypeAliasStub(
parent, classId.shortClassName.ref(), classId.asSingleFqName().ref(),
isTopLevel = !classId.isNestedClass)
- createModifierListStubForDeclaration(typeAlias, typeAliasProto.flags, arrayListOf(VISIBILITY), listOf())
+ val modifierList = createModifierListStubForDeclaration(typeAlias, typeAliasProto.flags, arrayListOf(VISIBILITY), listOf())
val typeStubBuilder = TypeClsStubBuilder(context)
val restConstraints = typeStubBuilder.createTypeParameterListStub(typeAlias, typeAliasProto.typeParameterList)
@@ -55,8 +52,7 @@ fun createTypeAliasStub(
}
if (Flags.HAS_ANNOTATIONS.get(typeAliasProto.flags)) {
- // TODO: support annotations
- // createAnnotationStubs(context.components.annotationLoader.loadClassAnnotations(thisAsProtoContainer), modifierList)
+ createAnnotationStubs(typeAliasProto.annotationList.map { context.nameResolver.getClassId(it.id) }, modifierList)
}
typeStubBuilder.createTypeReferenceStub(typeAlias, typeAliasProto.underlyingType)
diff --git a/idea/testData/decompiler/decompiledText/TypeAliases.expected.kt b/idea/testData/decompiler/decompiledText/TypeAliases.expected.kt
index e6040911e0b..24f2021a23e 100644
--- a/idea/testData/decompiler/decompiledText/TypeAliases.expected.kt
+++ b/idea/testData/decompiler/decompiledText/TypeAliases.expected.kt
@@ -8,5 +8,5 @@ public final class TypeAliases public constructor() {
public typealias B = (dependency.A) -> kotlin.Unit
- private typealias Parametrized = kotlin.collections.Map
+ @test.Ann private typealias Parametrized = kotlin.collections.Map
}
diff --git a/idea/testData/decompiler/decompiledText/TypeAliases/TypeAliases.kt b/idea/testData/decompiler/decompiledText/TypeAliases/TypeAliases.kt
index c3af14d21b8..2d5233e8db7 100644
--- a/idea/testData/decompiler/decompiledText/TypeAliases/TypeAliases.kt
+++ b/idea/testData/decompiler/decompiledText/TypeAliases/TypeAliases.kt
@@ -8,7 +8,7 @@ class Outer {
}
}
-annotation class Ann
+annotation class Ann(val value: String)
class TypeAliases {
typealias B = (A) -> Unit
@@ -17,7 +17,6 @@ class TypeAliases {
b.invoke(a)
}
- // TODO: annotations are unsupported yet
- @Ann
+ @Ann("OK")
private typealias Parametrized = Map
}
diff --git a/idea/testData/decompiler/stubBuilder/TypeAliases/TypeAliases.kt b/idea/testData/decompiler/stubBuilder/TypeAliases/TypeAliases.kt
index c3af14d21b8..eea088da381 100644
--- a/idea/testData/decompiler/stubBuilder/TypeAliases/TypeAliases.kt
+++ b/idea/testData/decompiler/stubBuilder/TypeAliases/TypeAliases.kt
@@ -17,7 +17,6 @@ class TypeAliases {
b.invoke(a)
}
- // TODO: annotations are unsupported yet
@Ann
private typealias Parametrized = Map
}
diff --git a/idea/testData/decompiler/stubBuilder/TypeAliases/TypeAliases.txt b/idea/testData/decompiler/stubBuilder/TypeAliases/TypeAliases.txt
index a6f6bc688da..2a0d66a1366 100644
--- a/idea/testData/decompiler/stubBuilder/TypeAliases/TypeAliases.txt
+++ b/idea/testData/decompiler/stubBuilder/TypeAliases/TypeAliases.txt
@@ -85,6 +85,13 @@ PsiJetFileStubImpl[package=test]
REFERENCE_EXPRESSION:[referencedName=Unit]
TYPEALIAS:[fqName=test.TypeAliases.Parametrized, isTopLevel=false, name=Parametrized]
MODIFIER_LIST:[private]
+ ANNOTATION_ENTRY:[hasValueArguments=false, shortName=Ann]
+ CONSTRUCTOR_CALLEE:
+ TYPE_REFERENCE:
+ USER_TYPE:
+ USER_TYPE:
+ REFERENCE_EXPRESSION:[referencedName=test]
+ REFERENCE_EXPRESSION:[referencedName=Ann]
TYPE_PARAMETER_LIST:
TYPE_PARAMETER:[fqName=null, isInVariance=false, isOutVariance=false, name=E]
TYPE_PARAMETER:[fqName=null, isInVariance=false, isOutVariance=false, name=F]
diff --git a/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java
index 6785477bf95..3a1ac5b8495 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java
@@ -3052,6 +3052,12 @@ public class ResolveByStubTestGenerated extends AbstractResolveByStubTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava/compiledKotlin/typealias"), Pattern.compile("^(.+)\\.kt$"), true);
}
+ @TestMetadata("Annotations.kt")
+ public void testAnnotations() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/typealias/Annotations.kt");
+ doTest(fileName);
+ }
+
@TestMetadata("Basic.kt")
public void testBasic() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/typealias/Basic.kt");