Support annotations on property accessors in JS/common metadata

#KT-14529 Fixed
This commit is contained in:
Alexander Udalov
2018-10-01 18:34:04 +02:00
parent d1e1e274d9
commit 1ee1d15b91
27 changed files with 443 additions and 106 deletions
@@ -522,6 +522,24 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
} }
} }
if (old.getExtensionCount(JsProtoBuf.propertyGetterAnnotation) != new.getExtensionCount(JsProtoBuf.propertyGetterAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(JsProtoBuf.propertyGetterAnnotation) - 1) {
if (!checkEquals(old.getExtension(JsProtoBuf.propertyGetterAnnotation, i), new.getExtension(JsProtoBuf.propertyGetterAnnotation, i))) return false
}
}
if (old.getExtensionCount(JsProtoBuf.propertySetterAnnotation) != new.getExtensionCount(JsProtoBuf.propertySetterAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(JsProtoBuf.propertySetterAnnotation) - 1) {
if (!checkEquals(old.getExtension(JsProtoBuf.propertySetterAnnotation, i), new.getExtension(JsProtoBuf.propertySetterAnnotation, i))) return false
}
}
if (old.hasExtension(JsProtoBuf.compileTimeValue) != new.hasExtension(JsProtoBuf.compileTimeValue)) return false if (old.hasExtension(JsProtoBuf.compileTimeValue) != new.hasExtension(JsProtoBuf.compileTimeValue)) return false
if (old.hasExtension(JsProtoBuf.compileTimeValue)) { if (old.hasExtension(JsProtoBuf.compileTimeValue)) {
if (!checkEquals(old.getExtension(JsProtoBuf.compileTimeValue), new.getExtension(JsProtoBuf.compileTimeValue))) return false if (!checkEquals(old.getExtension(JsProtoBuf.compileTimeValue), new.getExtension(JsProtoBuf.compileTimeValue))) return false
@@ -551,6 +569,24 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
} }
} }
if (old.getExtensionCount(BuiltInsProtoBuf.propertyGetterAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.propertyGetterAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.propertyGetterAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.propertyGetterAnnotation, i), new.getExtension(BuiltInsProtoBuf.propertyGetterAnnotation, i))) return false
}
}
if (old.getExtensionCount(BuiltInsProtoBuf.propertySetterAnnotation) != new.getExtensionCount(BuiltInsProtoBuf.propertySetterAnnotation)) {
return false
}
else {
for(i in 0..old.getExtensionCount(BuiltInsProtoBuf.propertySetterAnnotation) - 1) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.propertySetterAnnotation, i), new.getExtension(BuiltInsProtoBuf.propertySetterAnnotation, i))) return false
}
}
if (old.hasExtension(BuiltInsProtoBuf.compileTimeValue) != new.hasExtension(BuiltInsProtoBuf.compileTimeValue)) return false if (old.hasExtension(BuiltInsProtoBuf.compileTimeValue) != new.hasExtension(BuiltInsProtoBuf.compileTimeValue)) return false
if (old.hasExtension(BuiltInsProtoBuf.compileTimeValue)) { if (old.hasExtension(BuiltInsProtoBuf.compileTimeValue)) {
if (!checkEquals(old.getExtension(BuiltInsProtoBuf.compileTimeValue), new.getExtension(BuiltInsProtoBuf.compileTimeValue))) return false if (!checkEquals(old.getExtension(BuiltInsProtoBuf.compileTimeValue), new.getExtension(BuiltInsProtoBuf.compileTimeValue))) return false
@@ -1779,6 +1815,14 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + getExtension(JsProtoBuf.propertyAnnotation, i).hashCode(stringIndexes, fqNameIndexes) hashCode = 31 * hashCode + getExtension(JsProtoBuf.propertyAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
} }
for(i in 0..getExtensionCount(JsProtoBuf.propertyGetterAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(JsProtoBuf.propertyGetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
for(i in 0..getExtensionCount(JsProtoBuf.propertySetterAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(JsProtoBuf.propertySetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
if (hasExtension(JsProtoBuf.compileTimeValue)) { if (hasExtension(JsProtoBuf.compileTimeValue)) {
hashCode = 31 * hashCode + getExtension(JsProtoBuf.compileTimeValue).hashCode(stringIndexes, fqNameIndexes) hashCode = 31 * hashCode + getExtension(JsProtoBuf.compileTimeValue).hashCode(stringIndexes, fqNameIndexes)
} }
@@ -1799,6 +1843,14 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.propertyAnnotation, i).hashCode(stringIndexes, fqNameIndexes) hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.propertyAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
} }
for(i in 0..getExtensionCount(BuiltInsProtoBuf.propertyGetterAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.propertyGetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
for(i in 0..getExtensionCount(BuiltInsProtoBuf.propertySetterAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.propertySetterAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
if (hasExtension(BuiltInsProtoBuf.compileTimeValue)) { if (hasExtension(BuiltInsProtoBuf.compileTimeValue)) {
hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.compileTimeValue).hashCode(stringIndexes, fqNameIndexes) hashCode = 31 * hashCode + getExtension(BuiltInsProtoBuf.compileTimeValue).hashCode(stringIndexes, fqNameIndexes)
} }
@@ -12,6 +12,8 @@ public final class DebugBuiltInsProtoBuf {
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.constructorAnnotation); registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.constructorAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.functionAnnotation); registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.propertyAnnotation); registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.propertyGetterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.propertySetterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.compileTimeValue); registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.compileTimeValue);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.enumEntryAnnotation); registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.enumEntryAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.parameterAnnotation); registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.parameterAnnotation);
@@ -73,6 +75,28 @@ public final class DebugBuiltInsProtoBuf {
.newFileScopedGeneratedExtension( .newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class, org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance()); org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PROPERTY_GETTER_ANNOTATION_FIELD_NUMBER = 152;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> propertyGetterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PROPERTY_SETTER_ANNOTATION_FIELD_NUMBER = 153;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> propertySetterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 151; public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 151;
/** /**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code> * <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
@@ -153,22 +177,28 @@ public final class DebugBuiltInsProtoBuf {
"notation:p\n\023property_annotation\022\'.org.je" + "notation:p\n\023property_annotation\022\'.org.je" +
"tbrains.kotlin.metadata.Property\030\226\001 \003(\0132" + "tbrains.kotlin.metadata.Property\030\226\001 \003(\0132" +
").org.jetbrains.kotlin.metadata.Annotati" + ").org.jetbrains.kotlin.metadata.Annotati" +
"on:~\n\022compile_time_value\022\'.org.jetbrains" + "on:w\n\032property_getter_annotation\022\'.org.j" +
".kotlin.metadata.Property\030\227\001 \001(\01328.org.j" + "etbrains.kotlin.metadata.Property\030\230\001 \003(\013" +
"etbrains.kotlin.metadata.Annotation.Argu" + "2).org.jetbrains.kotlin.metadata.Annotat" +
"ment.Value:s\n\025enum_entry_annotation\022(.or", "ion:w\n\032property_setter_annotation\022\'.org.",
"g.jetbrains.kotlin.metadata.EnumEntry\030\226\001" + "jetbrains.kotlin.metadata.Property\030\231\001 \003(" +
" \003(\0132).org.jetbrains.kotlin.metadata.Ann" + "\0132).org.jetbrains.kotlin.metadata.Annota" +
"otation:w\n\024parameter_annotation\022-.org.je" + "tion:~\n\022compile_time_value\022\'.org.jetbrai" +
"tbrains.kotlin.metadata.ValueParameter\030\226" + "ns.kotlin.metadata.Property\030\227\001 \001(\01328.org" +
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" + ".jetbrains.kotlin.metadata.Annotation.Ar" +
"notation:h\n\017type_annotation\022#.org.jetbra" + "gument.Value:s\n\025enum_entry_annotation\022(." +
"ins.kotlin.metadata.Type\030\226\001 \003(\0132).org.je" + "org.jetbrains.kotlin.metadata.EnumEntry\030" +
"tbrains.kotlin.metadata.Annotation:{\n\031ty" + "\226\001 \003(\0132).org.jetbrains.kotlin.metadata.A" +
"pe_parameter_annotation\022,.org.jetbrains." + "nnotation:w\n\024parameter_annotation\022-.org." +
"kotlin.metadata.TypeParameter\030\226\001 \003(\0132).o", "jetbrains.kotlin.metadata.ValueParameter",
"rg.jetbrains.kotlin.metadata.AnnotationB" + "\030\226\001 \003(\0132).org.jetbrains.kotlin.metadata." +
"\027B\025DebugBuiltInsProtoBuf" "Annotation:h\n\017type_annotation\022#.org.jetb" +
"rains.kotlin.metadata.Type\030\226\001 \003(\0132).org." +
"jetbrains.kotlin.metadata.Annotation:{\n\031" +
"type_parameter_annotation\022,.org.jetbrain" +
"s.kotlin.metadata.TypeParameter\030\226\001 \003(\0132)" +
".org.jetbrains.kotlin.metadata.Annotatio" +
"nB\027B\025DebugBuiltInsProtoBuf"
}; };
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -188,11 +218,13 @@ public final class DebugBuiltInsProtoBuf {
constructorAnnotation.internalInit(descriptor.getExtensions().get(2)); constructorAnnotation.internalInit(descriptor.getExtensions().get(2));
functionAnnotation.internalInit(descriptor.getExtensions().get(3)); functionAnnotation.internalInit(descriptor.getExtensions().get(3));
propertyAnnotation.internalInit(descriptor.getExtensions().get(4)); propertyAnnotation.internalInit(descriptor.getExtensions().get(4));
compileTimeValue.internalInit(descriptor.getExtensions().get(5)); propertyGetterAnnotation.internalInit(descriptor.getExtensions().get(5));
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(6)); propertySetterAnnotation.internalInit(descriptor.getExtensions().get(6));
parameterAnnotation.internalInit(descriptor.getExtensions().get(7)); compileTimeValue.internalInit(descriptor.getExtensions().get(7));
typeAnnotation.internalInit(descriptor.getExtensions().get(8)); enumEntryAnnotation.internalInit(descriptor.getExtensions().get(8));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(9)); parameterAnnotation.internalInit(descriptor.getExtensions().get(9));
typeAnnotation.internalInit(descriptor.getExtensions().get(10));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(11));
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor(); org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor();
} }
@@ -14,6 +14,8 @@ public final class DebugJsProtoBuf {
registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.functionAnnotation); registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.functionContainingFileId); registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.functionContainingFileId);
registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.propertyAnnotation); registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.propertyGetterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.propertySetterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.compileTimeValue); registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.compileTimeValue);
registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.propertyContainingFileId); registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.propertyContainingFileId);
registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.enumEntryAnnotation); registry.add(org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf.enumEntryAnnotation);
@@ -4752,6 +4754,28 @@ public final class DebugJsProtoBuf {
.newFileScopedGeneratedExtension( .newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class, org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance()); org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PROPERTY_GETTER_ANNOTATION_FIELD_NUMBER = 132;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> propertyGetterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PROPERTY_SETTER_ANNOTATION_FIELD_NUMBER = 133;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> propertySetterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 131; public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 131;
/** /**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code> * <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
@@ -4900,27 +4924,33 @@ public final class DebugJsProtoBuf {
"ion\030\207\001 \001(\005:p\n\023property_annotation\022\'.org." + "ion\030\207\001 \001(\005:p\n\023property_annotation\022\'.org." +
"jetbrains.kotlin.metadata.Property\030\202\001 \003(" + "jetbrains.kotlin.metadata.Property\030\202\001 \003(" +
"\0132).org.jetbrains.kotlin.metadata.Annota" + "\0132).org.jetbrains.kotlin.metadata.Annota" +
"tion:~\n\022compile_time_value\022\'.org.jetbrai" + "tion:w\n\032property_getter_annotation\022\'.org" +
"ns.kotlin.metadata.Property\030\203\001 \001(\01328.org" + ".jetbrains.kotlin.metadata.Property\030\204\001 \003" +
".jetbrains.kotlin.metadata.Annotation.Ar", "(\0132).org.jetbrains.kotlin.metadata.Annot",
"gument.Value:M\n\033property_containing_file" + "ation:w\n\032property_setter_annotation\022\'.or" +
"_id\022\'.org.jetbrains.kotlin.metadata.Prop" + "g.jetbrains.kotlin.metadata.Property\030\205\001 " +
"erty\030\207\001 \001(\005:s\n\025enum_entry_annotation\022(.o" + "\003(\0132).org.jetbrains.kotlin.metadata.Anno" +
"rg.jetbrains.kotlin.metadata.EnumEntry\030\202" + "tation:~\n\022compile_time_value\022\'.org.jetbr" +
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" + "ains.kotlin.metadata.Property\030\203\001 \001(\01328.o" +
"notation:w\n\024parameter_annotation\022-.org.j" + "rg.jetbrains.kotlin.metadata.Annotation." +
"etbrains.kotlin.metadata.ValueParameter\030" + "Argument.Value:M\n\033property_containing_fi" +
"\202\001 \003(\0132).org.jetbrains.kotlin.metadata.A" + "le_id\022\'.org.jetbrains.kotlin.metadata.Pr" +
"nnotation:h\n\017type_annotation\022#.org.jetbr" + "operty\030\207\001 \001(\005:s\n\025enum_entry_annotation\022(" +
"ains.kotlin.metadata.Type\030\202\001 \003(\0132).org.j", ".org.jetbrains.kotlin.metadata.EnumEntry",
"etbrains.kotlin.metadata.Annotation:{\n\031t" + "\030\202\001 \003(\0132).org.jetbrains.kotlin.metadata." +
"ype_parameter_annotation\022,.org.jetbrains" + "Annotation:w\n\024parameter_annotation\022-.org" +
".kotlin.metadata.TypeParameter\030\202\001 \003(\0132)." + ".jetbrains.kotlin.metadata.ValueParamete" +
"org.jetbrains.kotlin.metadata.Annotation" + "r\030\202\001 \003(\0132).org.jetbrains.kotlin.metadata" +
":x\n\026package_fragment_files\022..org.jetbrai" + ".Annotation:h\n\017type_annotation\022#.org.jet" +
"ns.kotlin.metadata.PackageFragment\030\202\001 \001(" + "brains.kotlin.metadata.Type\030\202\001 \003(\0132).org" +
"\0132\'.org.jetbrains.kotlin.metadata.js.Fil" + ".jetbrains.kotlin.metadata.Annotation:{\n" +
"esB\021B\017DebugJsProtoBuf" "\031type_parameter_annotation\022,.org.jetbrai" +
"ns.kotlin.metadata.TypeParameter\030\202\001 \003(\0132" +
").org.jetbrains.kotlin.metadata.Annotati",
"on:x\n\026package_fragment_files\022..org.jetbr" +
"ains.kotlin.metadata.PackageFragment\030\202\001 " +
"\001(\0132\'.org.jetbrains.kotlin.metadata.js.F" +
"ilesB\021B\017DebugJsProtoBuf"
}; };
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -4972,13 +5002,15 @@ public final class DebugJsProtoBuf {
functionAnnotation.internalInit(descriptor.getExtensions().get(4)); functionAnnotation.internalInit(descriptor.getExtensions().get(4));
functionContainingFileId.internalInit(descriptor.getExtensions().get(5)); functionContainingFileId.internalInit(descriptor.getExtensions().get(5));
propertyAnnotation.internalInit(descriptor.getExtensions().get(6)); propertyAnnotation.internalInit(descriptor.getExtensions().get(6));
compileTimeValue.internalInit(descriptor.getExtensions().get(7)); propertyGetterAnnotation.internalInit(descriptor.getExtensions().get(7));
propertyContainingFileId.internalInit(descriptor.getExtensions().get(8)); propertySetterAnnotation.internalInit(descriptor.getExtensions().get(8));
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(9)); compileTimeValue.internalInit(descriptor.getExtensions().get(9));
parameterAnnotation.internalInit(descriptor.getExtensions().get(10)); propertyContainingFileId.internalInit(descriptor.getExtensions().get(10));
typeAnnotation.internalInit(descriptor.getExtensions().get(11)); enumEntryAnnotation.internalInit(descriptor.getExtensions().get(11));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(12)); parameterAnnotation.internalInit(descriptor.getExtensions().get(12));
packageFragmentFiles.internalInit(descriptor.getExtensions().get(13)); typeAnnotation.internalInit(descriptor.getExtensions().get(13));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(14));
packageFragmentFiles.internalInit(descriptor.getExtensions().get(15));
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor(); org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor();
} }
@@ -14,6 +14,8 @@ public final class DebugKonanProtoBuf {
registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.functionAnnotation); registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.inlineIrBody); registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.inlineIrBody);
registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.propertyAnnotation); registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.propertyGetterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.propertySetterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.hasBackingField); registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.hasBackingField);
registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.usedAsVariable); registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.usedAsVariable);
registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.compileTimeValue); registry.add(org.jetbrains.kotlin.metadata.konan.DebugKonanProtoBuf.compileTimeValue);
@@ -3930,6 +3932,28 @@ public final class DebugKonanProtoBuf {
.newFileScopedGeneratedExtension( .newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class, org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance()); org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PROPERTY_GETTER_ANNOTATION_FIELD_NUMBER = 176;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> propertyGetterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PROPERTY_SETTER_ANNOTATION_FIELD_NUMBER = 177;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> propertySetterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int HAS_BACKING_FIELD_FIELD_NUMBER = 171; public static final int HAS_BACKING_FIELD_FIELD_NUMBER = 171;
/** /**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code> * <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
@@ -4120,35 +4144,41 @@ public final class DebugKonanProtoBuf {
"nlineIrBody:p\n\023property_annotation\022\'.org" + "nlineIrBody:p\n\023property_annotation\022\'.org" +
".jetbrains.kotlin.metadata.Property\030\252\001 \003" + ".jetbrains.kotlin.metadata.Property\030\252\001 \003" +
"(\0132).org.jetbrains.kotlin.metadata.Annot" + "(\0132).org.jetbrains.kotlin.metadata.Annot" +
"ation:C\n\021has_backing_field\022\'.org.jetbrai" + "ation:w\n\032property_getter_annotation\022\'.or" +
"ns.kotlin.metadata.Property\030\253\001 \001(\010:B\n\020us" + "g.jetbrains.kotlin.metadata.Property\030\260\001 " +
"ed_as_variable\022\'.org.jetbrains.kotlin.me" + "\003(\0132).org.jetbrains.kotlin.metadata.Anno" +
"tadata.Property\030\254\001 \001(\010:~\n\022compile_time_v", "tation:w\n\032property_setter_annotation\022\'.o",
"alue\022\'.org.jetbrains.kotlin.metadata.Pro" + "rg.jetbrains.kotlin.metadata.Property\030\261\001" +
"perty\030\255\001 \001(\01328.org.jetbrains.kotlin.meta" + " \003(\0132).org.jetbrains.kotlin.metadata.Ann" +
"data.Annotation.Argument.Value:z\n\025inline" + "otation:C\n\021has_backing_field\022\'.org.jetbr" +
"_getter_ir_body\022\'.org.jetbrains.kotlin.m" + "ains.kotlin.metadata.Property\030\253\001 \001(\010:B\n\020" +
"etadata.Property\030\256\001 \001(\01321.org.jetbrains." + "used_as_variable\022\'.org.jetbrains.kotlin." +
"kotlin.metadata.konan.InlineIrBody:z\n\025in" + "metadata.Property\030\254\001 \001(\010:~\n\022compile_time" +
"line_setter_ir_body\022\'.org.jetbrains.kotl" + "_value\022\'.org.jetbrains.kotlin.metadata.P" +
"in.metadata.Property\030\257\001 \001(\01321.org.jetbra" + "roperty\030\255\001 \001(\01328.org.jetbrains.kotlin.me" +
"ins.kotlin.metadata.konan.InlineIrBody:s" + "tadata.Annotation.Argument.Value:z\n\025inli" +
"\n\025enum_entry_annotation\022(.org.jetbrains.", "ne_getter_ir_body\022\'.org.jetbrains.kotlin",
"kotlin.metadata.EnumEntry\030\252\001 \003(\0132).org.j" + ".metadata.Property\030\256\001 \001(\01321.org.jetbrain" +
"etbrains.kotlin.metadata.Annotation:E\n\022e" + "s.kotlin.metadata.konan.InlineIrBody:z\n\025" +
"num_entry_ordinal\022(.org.jetbrains.kotlin" + "inline_setter_ir_body\022\'.org.jetbrains.ko" +
".metadata.EnumEntry\030\253\001 \001(\005:w\n\024parameter_" + "tlin.metadata.Property\030\257\001 \001(\01321.org.jetb" +
"annotation\022-.org.jetbrains.kotlin.metada" + "rains.kotlin.metadata.konan.InlineIrBody" +
"ta.ValueParameter\030\252\001 \003(\0132).org.jetbrains" + ":s\n\025enum_entry_annotation\022(.org.jetbrain" +
".kotlin.metadata.Annotation:h\n\017type_anno" + "s.kotlin.metadata.EnumEntry\030\252\001 \003(\0132).org" +
"tation\022#.org.jetbrains.kotlin.metadata.T" + ".jetbrains.kotlin.metadata.Annotation:E\n" +
"ype\030\252\001 \003(\0132).org.jetbrains.kotlin.metada" + "\022enum_entry_ordinal\022(.org.jetbrains.kotl" +
"ta.Annotation:7\n\ttype_text\022#.org.jetbrai", "in.metadata.EnumEntry\030\253\001 \001(\005:w\n\024paramete",
"ns.kotlin.metadata.Type\030\254\001 \001(\t:{\n\031type_p" + "r_annotation\022-.org.jetbrains.kotlin.meta" +
"arameter_annotation\022,.org.jetbrains.kotl" + "data.ValueParameter\030\252\001 \003(\0132).org.jetbrai" +
"in.metadata.TypeParameter\030\252\001 \003(\0132).org.j" + "ns.kotlin.metadata.Annotation:h\n\017type_an" +
"etbrains.kotlin.metadata.AnnotationB\024B\022D" + "notation\022#.org.jetbrains.kotlin.metadata" +
"ebugKonanProtoBuf" ".Type\030\252\001 \003(\0132).org.jetbrains.kotlin.meta" +
"data.Annotation:7\n\ttype_text\022#.org.jetbr" +
"ains.kotlin.metadata.Type\030\254\001 \001(\t:{\n\031type" +
"_parameter_annotation\022,.org.jetbrains.ko" +
"tlin.metadata.TypeParameter\030\252\001 \003(\0132).org" +
".jetbrains.kotlin.metadata.AnnotationB\024B",
"\022DebugKonanProtoBuf"
}; };
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -4194,17 +4224,19 @@ public final class DebugKonanProtoBuf {
functionAnnotation.internalInit(descriptor.getExtensions().get(4)); functionAnnotation.internalInit(descriptor.getExtensions().get(4));
inlineIrBody.internalInit(descriptor.getExtensions().get(5)); inlineIrBody.internalInit(descriptor.getExtensions().get(5));
propertyAnnotation.internalInit(descriptor.getExtensions().get(6)); propertyAnnotation.internalInit(descriptor.getExtensions().get(6));
hasBackingField.internalInit(descriptor.getExtensions().get(7)); propertyGetterAnnotation.internalInit(descriptor.getExtensions().get(7));
usedAsVariable.internalInit(descriptor.getExtensions().get(8)); propertySetterAnnotation.internalInit(descriptor.getExtensions().get(8));
compileTimeValue.internalInit(descriptor.getExtensions().get(9)); hasBackingField.internalInit(descriptor.getExtensions().get(9));
inlineGetterIrBody.internalInit(descriptor.getExtensions().get(10)); usedAsVariable.internalInit(descriptor.getExtensions().get(10));
inlineSetterIrBody.internalInit(descriptor.getExtensions().get(11)); compileTimeValue.internalInit(descriptor.getExtensions().get(11));
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(12)); inlineGetterIrBody.internalInit(descriptor.getExtensions().get(12));
enumEntryOrdinal.internalInit(descriptor.getExtensions().get(13)); inlineSetterIrBody.internalInit(descriptor.getExtensions().get(13));
parameterAnnotation.internalInit(descriptor.getExtensions().get(14)); enumEntryAnnotation.internalInit(descriptor.getExtensions().get(14));
typeAnnotation.internalInit(descriptor.getExtensions().get(15)); enumEntryOrdinal.internalInit(descriptor.getExtensions().get(15));
typeText.internalInit(descriptor.getExtensions().get(16)); parameterAnnotation.internalInit(descriptor.getExtensions().get(16));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(17)); typeAnnotation.internalInit(descriptor.getExtensions().get(17));
typeText.internalInit(descriptor.getExtensions().get(18));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(19));
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor(); org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor();
} }
@@ -36,9 +36,9 @@ object KotlinStubVersions {
// BuiltIn stub version should be increased if changes are made to builtIn stub building subsystem (org.jetbrains.kotlin.idea.decompiler.builtIns) // BuiltIn stub version should be increased if changes are made to builtIn stub building subsystem (org.jetbrains.kotlin.idea.decompiler.builtIns)
// Increasing this version will lead to reindexing of all builtIn files (see KotlinBuiltInFileType). // Increasing this version will lead to reindexing of all builtIn files (see KotlinBuiltInFileType).
const val BUILTIN_STUB_VERSION = BINARY_STUB_VERSION + 2 const val BUILTIN_STUB_VERSION = BINARY_STUB_VERSION + 3
// JS stub version should be increased if changes are made to js stub building subsystem (org.jetbrains.kotlin.idea.decompiler.js) // JS stub version should be increased if changes are made to js stub building subsystem (org.jetbrains.kotlin.idea.decompiler.js)
// Increasing this version will lead to reindexing of js binary files (see KotlinJavaScriptMetaFileType). // Increasing this version will lead to reindexing of js binary files (see KotlinJavaScriptMetaFileType).
const val JS_STUB_VERSION = BINARY_STUB_VERSION + 2 const val JS_STUB_VERSION = BINARY_STUB_VERSION + 3
} }
@@ -61,6 +61,12 @@ abstract class KotlinSerializerExtensionBase(private val protocol: SerializerExt
for (annotation in descriptor.nonSourceAnnotations) { for (annotation in descriptor.nonSourceAnnotations) {
proto.addExtension(protocol.propertyAnnotation, annotationSerializer.serializeAnnotation(annotation)) proto.addExtension(protocol.propertyAnnotation, annotationSerializer.serializeAnnotation(annotation))
} }
for (annotation in descriptor.getter?.nonSourceAnnotations.orEmpty()) {
proto.addExtension(protocol.propertyGetterAnnotation, annotationSerializer.serializeAnnotation(annotation))
}
for (annotation in descriptor.setter?.nonSourceAnnotations.orEmpty()) {
proto.addExtension(protocol.propertySetterAnnotation, annotationSerializer.serializeAnnotation(annotation))
}
val constantInitializer = descriptor.compileTimeInitializer ?: return val constantInitializer = descriptor.compileTimeInitializer ?: return
if (constantInitializer !is NullValue) { if (constantInitializer !is NullValue) {
proto.setExtension(protocol.compileTimeValue, annotationSerializer.valueProto(constantInitializer).build()) proto.setExtension(protocol.compileTimeValue, annotationSerializer.valueProto(constantInitializer).build())
@@ -0,0 +1,10 @@
package test
annotation class Anno(val value: String)
@Anno("property") val v1 = ""
var v2: String
@Anno("getter") get() = ""
@Anno("setter") set(@Anno("setparam") value) {
}
@@ -0,0 +1,9 @@
package test
@test.Anno(value = "property") public val v1: kotlin.String = ""
@get:test.Anno(value = "getter") @set:test.Anno(value = "setter") @setparam:test.Anno(value = "setparam") public var v2: kotlin.String
public final annotation class Anno : kotlin.Annotation {
public constructor Anno(/*0*/ value: kotlin.String)
public final val value: kotlin.String
}
@@ -112,4 +112,8 @@ class BuiltInsSerializerTest : TestCaseWithTmpdir() {
fun testBinaryRetainedAnnotation() { fun testBinaryRetainedAnnotation() {
doTest("binaryRetainedAnnotation.kt") doTest("binaryRetainedAnnotation.kt")
} }
fun testPropertyAccessorAnnotations() {
doTest("propertyAccessorAnnotations.kt")
}
} }
@@ -152,4 +152,8 @@ class KotlinJavascriptSerializerTest : TestCaseWithTmpdir() {
fun testEnum() { fun testEnum() {
doTest("builtinsSerializer/annotationArguments/enum.kt") doTest("builtinsSerializer/annotationArguments/enum.kt")
} }
fun testPropertyAccessorAnnotations() {
doTest("builtinsSerializer/propertyAccessorAnnotations.kt")
}
} }
@@ -33,7 +33,7 @@ class JsMetadataVersion(vararg numbers: Int) : BinaryVersion(*numbers) {
companion object { companion object {
@JvmField @JvmField
val INSTANCE = JsMetadataVersion(1, 2, 5) val INSTANCE = JsMetadataVersion(1, 2, 6)
@JvmField @JvmField
val INVALID_VERSION = JsMetadataVersion() val INVALID_VERSION = JsMetadataVersion()
@@ -27,6 +27,8 @@ open class SerializerExtensionProtocol(
val classAnnotation: GeneratedExtension<ProtoBuf.Class, List<ProtoBuf.Annotation>>, val classAnnotation: GeneratedExtension<ProtoBuf.Class, List<ProtoBuf.Annotation>>,
val functionAnnotation: GeneratedExtension<ProtoBuf.Function, List<ProtoBuf.Annotation>>, val functionAnnotation: GeneratedExtension<ProtoBuf.Function, List<ProtoBuf.Annotation>>,
val propertyAnnotation: GeneratedExtension<ProtoBuf.Property, List<ProtoBuf.Annotation>>, val propertyAnnotation: GeneratedExtension<ProtoBuf.Property, List<ProtoBuf.Annotation>>,
val propertyGetterAnnotation: GeneratedExtension<ProtoBuf.Property, List<ProtoBuf.Annotation>>,
val propertySetterAnnotation: GeneratedExtension<ProtoBuf.Property, List<ProtoBuf.Annotation>>,
val enumEntryAnnotation: GeneratedExtension<ProtoBuf.EnumEntry, List<ProtoBuf.Annotation>>, val enumEntryAnnotation: GeneratedExtension<ProtoBuf.EnumEntry, List<ProtoBuf.Annotation>>,
val compileTimeValue: GeneratedExtension<ProtoBuf.Property, ProtoBuf.Annotation.Argument.Value>, val compileTimeValue: GeneratedExtension<ProtoBuf.Property, ProtoBuf.Annotation.Argument.Value>,
val parameterAnnotation: GeneratedExtension<ProtoBuf.ValueParameter, List<ProtoBuf.Annotation>>, val parameterAnnotation: GeneratedExtension<ProtoBuf.ValueParameter, List<ProtoBuf.Annotation>>,
@@ -47,7 +47,12 @@ class AnnotationAndConstantLoaderImpl(
val annotations = when (proto) { val annotations = when (proto) {
is ProtoBuf.Constructor -> proto.getExtension(protocol.constructorAnnotation) is ProtoBuf.Constructor -> proto.getExtension(protocol.constructorAnnotation)
is ProtoBuf.Function -> proto.getExtension(protocol.functionAnnotation) is ProtoBuf.Function -> proto.getExtension(protocol.functionAnnotation)
is ProtoBuf.Property -> proto.getExtension(protocol.propertyAnnotation) is ProtoBuf.Property -> when (kind) {
AnnotatedCallableKind.PROPERTY -> proto.getExtension(protocol.propertyAnnotation)
AnnotatedCallableKind.PROPERTY_GETTER -> proto.getExtension(protocol.propertyGetterAnnotation)
AnnotatedCallableKind.PROPERTY_SETTER -> proto.getExtension(protocol.propertySetterAnnotation)
else -> error("Unsupported callable kind with property proto")
}
else -> error("Unknown message: $proto") else -> error("Unknown message: $proto")
}.orEmpty() }.orEmpty()
return annotations.map { annotationProto -> return annotations.map { annotationProto ->
@@ -11,11 +11,19 @@ import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite
import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol
object BuiltInSerializerProtocol : SerializerExtensionProtocol( object BuiltInSerializerProtocol : SerializerExtensionProtocol(
ExtensionRegistryLite.newInstance().apply { BuiltInsProtoBuf.registerAllExtensions(this) }, ExtensionRegistryLite.newInstance().apply(BuiltInsProtoBuf::registerAllExtensions),
BuiltInsProtoBuf.packageFqName, BuiltInsProtoBuf.packageFqName,
BuiltInsProtoBuf.constructorAnnotation, BuiltInsProtoBuf.classAnnotation, BuiltInsProtoBuf.functionAnnotation, BuiltInsProtoBuf.constructorAnnotation,
BuiltInsProtoBuf.propertyAnnotation, BuiltInsProtoBuf.enumEntryAnnotation, BuiltInsProtoBuf.compileTimeValue, BuiltInsProtoBuf.classAnnotation,
BuiltInsProtoBuf.parameterAnnotation, BuiltInsProtoBuf.typeAnnotation, BuiltInsProtoBuf.typeParameterAnnotation BuiltInsProtoBuf.functionAnnotation,
BuiltInsProtoBuf.propertyAnnotation,
BuiltInsProtoBuf.propertyGetterAnnotation,
BuiltInsProtoBuf.propertySetterAnnotation,
BuiltInsProtoBuf.enumEntryAnnotation,
BuiltInsProtoBuf.compileTimeValue,
BuiltInsProtoBuf.parameterAnnotation,
BuiltInsProtoBuf.typeAnnotation,
BuiltInsProtoBuf.typeParameterAnnotation
) { ) {
const val BUILTINS_FILE_EXTENSION = "kotlin_builtins" const val BUILTINS_FILE_EXTENSION = "kotlin_builtins"
+2
View File
@@ -39,6 +39,8 @@ extend Function {
extend Property { extend Property {
repeated Annotation property_annotation = 150; repeated Annotation property_annotation = 150;
repeated Annotation property_getter_annotation = 152;
repeated Annotation property_setter_annotation = 153;
optional Annotation.Argument.Value compile_time_value = 151; optional Annotation.Argument.Value compile_time_value = 151;
} }
@@ -19,7 +19,7 @@ class BuiltInsBinaryVersion(vararg numbers: Int) : BinaryVersion(*numbers) {
companion object { companion object {
@JvmField @JvmField
val INSTANCE = BuiltInsBinaryVersion(1, 0, 6) val INSTANCE = BuiltInsBinaryVersion(1, 0, 7)
@JvmField @JvmField
val INVALID_VERSION = BuiltInsBinaryVersion() val INVALID_VERSION = BuiltInsBinaryVersion()
@@ -12,6 +12,8 @@ public final class BuiltInsProtoBuf {
registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.constructorAnnotation); registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.constructorAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.functionAnnotation); registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.propertyAnnotation); registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.propertyGetterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.propertySetterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.compileTimeValue); registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.compileTimeValue);
registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.enumEntryAnnotation); registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.enumEntryAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.parameterAnnotation); registry.add(org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf.parameterAnnotation);
@@ -98,6 +100,38 @@ public final class BuiltInsProtoBuf {
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE, org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE,
false, false,
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.class); org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.class);
public static final int PROPERTY_GETTER_ANNOTATION_FIELD_NUMBER = 152;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.ProtoBuf.Annotation>> propertyGetterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newRepeatedGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Property.getDefaultInstance(),
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.getDefaultInstance(),
null,
152,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE,
false,
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.class);
public static final int PROPERTY_SETTER_ANNOTATION_FIELD_NUMBER = 153;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.ProtoBuf.Annotation>> propertySetterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newRepeatedGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Property.getDefaultInstance(),
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.getDefaultInstance(),
null,
153,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE,
false,
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.class);
public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 151; public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 151;
/** /**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code> * <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
@@ -42,7 +42,12 @@ class AnnotationLoaderForStubBuilderImpl(
val annotations = when (proto) { val annotations = when (proto) {
is ProtoBuf.Constructor -> proto.getExtension(protocol.constructorAnnotation) is ProtoBuf.Constructor -> proto.getExtension(protocol.constructorAnnotation)
is ProtoBuf.Function -> proto.getExtension(protocol.functionAnnotation) is ProtoBuf.Function -> proto.getExtension(protocol.functionAnnotation)
is ProtoBuf.Property -> proto.getExtension(protocol.propertyAnnotation) is ProtoBuf.Property -> when (kind) {
AnnotatedCallableKind.PROPERTY -> proto.getExtension(protocol.propertyAnnotation)
AnnotatedCallableKind.PROPERTY_GETTER -> proto.getExtension(protocol.propertyGetterAnnotation)
AnnotatedCallableKind.PROPERTY_SETTER -> proto.getExtension(protocol.propertySetterAnnotation)
else -> error("Unsupported callable kind with property proto")
}
else -> error("Unknown message: $proto") else -> error("Unknown message: $proto")
}.orEmpty() }.orEmpty()
return annotations.map { container.nameResolver.getClassId(it.id) } return annotations.map { container.nameResolver.getClassId(it.id) }
+2
View File
@@ -71,6 +71,8 @@ extend Function {
extend Property { extend Property {
repeated Annotation property_annotation = 130; repeated Annotation property_annotation = 130;
repeated Annotation property_getter_annotation = 132;
repeated Annotation property_setter_annotation = 133;
optional Annotation.Argument.Value compile_time_value = 131; optional Annotation.Argument.Value compile_time_value = 131;
optional int32 property_containing_file_id = 135; optional int32 property_containing_file_id = 135;
} }
@@ -14,6 +14,8 @@ public final class JsProtoBuf {
registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.functionAnnotation); registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.functionContainingFileId); registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.functionContainingFileId);
registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.propertyAnnotation); registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.propertyGetterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.propertySetterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.compileTimeValue); registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.compileTimeValue);
registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.propertyContainingFileId); registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.propertyContainingFileId);
registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.enumEntryAnnotation); registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.enumEntryAnnotation);
@@ -3755,6 +3757,38 @@ public final class JsProtoBuf {
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE, org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE,
false, false,
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.class); org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.class);
public static final int PROPERTY_GETTER_ANNOTATION_FIELD_NUMBER = 132;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.ProtoBuf.Annotation>> propertyGetterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newRepeatedGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Property.getDefaultInstance(),
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.getDefaultInstance(),
null,
132,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE,
false,
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.class);
public static final int PROPERTY_SETTER_ANNOTATION_FIELD_NUMBER = 133;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.ProtoBuf.Annotation>> propertySetterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newRepeatedGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Property.getDefaultInstance(),
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.getDefaultInstance(),
null,
133,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE,
false,
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.class);
public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 131; public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 131;
/** /**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code> * <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
@@ -12,16 +12,14 @@ import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite
import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol
object JsSerializerProtocol : SerializerExtensionProtocol( object JsSerializerProtocol : SerializerExtensionProtocol(
ExtensionRegistryLite.newInstance().apply { ExtensionRegistryLite.newInstance().apply(JsProtoBuf::registerAllExtensions),
JsProtoBuf.registerAllExtensions(
this
)
},
JsProtoBuf.packageFqName, JsProtoBuf.packageFqName,
JsProtoBuf.constructorAnnotation, JsProtoBuf.constructorAnnotation,
JsProtoBuf.classAnnotation, JsProtoBuf.classAnnotation,
JsProtoBuf.functionAnnotation, JsProtoBuf.functionAnnotation,
JsProtoBuf.propertyAnnotation, JsProtoBuf.propertyAnnotation,
JsProtoBuf.propertyGetterAnnotation,
JsProtoBuf.propertySetterAnnotation,
JsProtoBuf.enumEntryAnnotation, JsProtoBuf.enumEntryAnnotation,
JsProtoBuf.compileTimeValue, JsProtoBuf.compileTimeValue,
JsProtoBuf.parameterAnnotation, JsProtoBuf.parameterAnnotation,
@@ -35,4 +33,4 @@ object JsSerializerProtocol : SerializerExtensionProtocol(
"." + "." +
KotlinJavascriptSerializationUtil.CLASS_METADATA_FILE_EXTENSION KotlinJavascriptSerializationUtil.CLASS_METADATA_FILE_EXTENSION
} }
} }
@@ -5348,6 +5348,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
runTest("js/js.translator/testData/box/jsName/privateMethod.kt"); runTest("js/js.translator/testData/box/jsName/privateMethod.kt");
} }
@TestMetadata("propertyAccessorFromOtherModule.kt")
public void testPropertyAccessorFromOtherModule() throws Exception {
runTest("js/js.translator/testData/box/jsName/propertyAccessorFromOtherModule.kt");
}
@TestMetadata("secondaryConstructor.kt") @TestMetadata("secondaryConstructor.kt")
public void testSecondaryConstructor() throws Exception { public void testSecondaryConstructor() throws Exception {
runTest("js/js.translator/testData/box/jsName/secondaryConstructor.kt"); runTest("js/js.translator/testData/box/jsName/secondaryConstructor.kt");
@@ -5348,6 +5348,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
runTest("js/js.translator/testData/box/jsName/privateMethod.kt"); runTest("js/js.translator/testData/box/jsName/privateMethod.kt");
} }
@TestMetadata("propertyAccessorFromOtherModule.kt")
public void testPropertyAccessorFromOtherModule() throws Exception {
runTest("js/js.translator/testData/box/jsName/propertyAccessorFromOtherModule.kt");
}
@TestMetadata("secondaryConstructor.kt") @TestMetadata("secondaryConstructor.kt")
public void testSecondaryConstructor() throws Exception { public void testSecondaryConstructor() throws Exception {
runTest("js/js.translator/testData/box/jsName/secondaryConstructor.kt"); runTest("js/js.translator/testData/box/jsName/secondaryConstructor.kt");
@@ -0,0 +1,18 @@
// EXPECTED_REACHABLE_NODES: 1281
// MODULE: lib
// FILE: lib.kt
package lib
val foo: Int
@JsName("getBar") get() = 23
// MODULE: main(lib)
// FILE: main.kt
package main
import lib.*
fun box(): String {
if (foo != 23) return "fail: $foo"
return "OK"
}
+2
View File
@@ -34,6 +34,8 @@ extend Function {
extend Property { extend Property {
repeated Annotation property_annotation = 170; repeated Annotation property_annotation = 170;
repeated Annotation property_getter_annotation = 176;
repeated Annotation property_setter_annotation = 177;
optional bool has_backing_field = 171; optional bool has_backing_field = 171;
optional bool used_as_variable = 172; optional bool used_as_variable = 172;
optional Annotation.Argument.Value compile_time_value = 173; optional Annotation.Argument.Value compile_time_value = 173;
@@ -14,6 +14,8 @@ public final class KonanProtoBuf {
registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.functionAnnotation); registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.inlineIrBody); registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.inlineIrBody);
registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.propertyAnnotation); registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.propertyGetterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.propertySetterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.hasBackingField); registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.hasBackingField);
registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.usedAsVariable); registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.usedAsVariable);
registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.compileTimeValue); registry.add(org.jetbrains.kotlin.metadata.konan.KonanProtoBuf.compileTimeValue);
@@ -3315,6 +3317,38 @@ public final class KonanProtoBuf {
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE, org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE,
false, false,
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.class); org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.class);
public static final int PROPERTY_GETTER_ANNOTATION_FIELD_NUMBER = 176;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.ProtoBuf.Annotation>> propertyGetterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newRepeatedGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Property.getDefaultInstance(),
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.getDefaultInstance(),
null,
176,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE,
false,
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.class);
public static final int PROPERTY_SETTER_ANNOTATION_FIELD_NUMBER = 177;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.ProtoBuf.Annotation>> propertySetterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newRepeatedGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Property.getDefaultInstance(),
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.getDefaultInstance(),
null,
177,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE,
false,
org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.class);
public static final int HAS_BACKING_FIELD_FIELD_NUMBER = 171; public static final int HAS_BACKING_FIELD_FIELD_NUMBER = 171;
/** /**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code> * <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
@@ -10,12 +10,14 @@ import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite
import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol
object KonanSerializerProtocol : SerializerExtensionProtocol( object KonanSerializerProtocol : SerializerExtensionProtocol(
ExtensionRegistryLite.newInstance().apply { KonanProtoBuf.registerAllExtensions(this) }, ExtensionRegistryLite.newInstance().apply(KonanProtoBuf::registerAllExtensions),
KonanProtoBuf.packageFqName, KonanProtoBuf.packageFqName,
KonanProtoBuf.constructorAnnotation, KonanProtoBuf.constructorAnnotation,
KonanProtoBuf.classAnnotation, KonanProtoBuf.classAnnotation,
KonanProtoBuf.functionAnnotation, KonanProtoBuf.functionAnnotation,
KonanProtoBuf.propertyAnnotation, KonanProtoBuf.propertyAnnotation,
KonanProtoBuf.propertyGetterAnnotation,
KonanProtoBuf.propertySetterAnnotation,
KonanProtoBuf.enumEntryAnnotation, KonanProtoBuf.enumEntryAnnotation,
KonanProtoBuf.compileTimeValue, KonanProtoBuf.compileTimeValue,
KonanProtoBuf.parameterAnnotation, KonanProtoBuf.parameterAnnotation,