Support annotations on property accessors in JS/common metadata
#KT-14529 Fixed
This commit is contained in:
@@ -71,6 +71,8 @@ extend Function {
|
||||
|
||||
extend Property {
|
||||
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 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.functionContainingFileId);
|
||||
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.propertyContainingFileId);
|
||||
registry.add(org.jetbrains.kotlin.metadata.js.JsProtoBuf.enumEntryAnnotation);
|
||||
@@ -3755,6 +3757,38 @@ public final class JsProtoBuf {
|
||||
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.MESSAGE,
|
||||
false,
|
||||
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;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
|
||||
|
||||
@@ -12,16 +12,14 @@ import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite
|
||||
import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol
|
||||
|
||||
object JsSerializerProtocol : SerializerExtensionProtocol(
|
||||
ExtensionRegistryLite.newInstance().apply {
|
||||
JsProtoBuf.registerAllExtensions(
|
||||
this
|
||||
)
|
||||
},
|
||||
ExtensionRegistryLite.newInstance().apply(JsProtoBuf::registerAllExtensions),
|
||||
JsProtoBuf.packageFqName,
|
||||
JsProtoBuf.constructorAnnotation,
|
||||
JsProtoBuf.classAnnotation,
|
||||
JsProtoBuf.functionAnnotation,
|
||||
JsProtoBuf.propertyAnnotation,
|
||||
JsProtoBuf.propertyGetterAnnotation,
|
||||
JsProtoBuf.propertySetterAnnotation,
|
||||
JsProtoBuf.enumEntryAnnotation,
|
||||
JsProtoBuf.compileTimeValue,
|
||||
JsProtoBuf.parameterAnnotation,
|
||||
@@ -35,4 +33,4 @@ object JsSerializerProtocol : SerializerExtensionProtocol(
|
||||
"." +
|
||||
KotlinJavascriptSerializationUtil.CLASS_METADATA_FILE_EXTENSION
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -5348,6 +5348,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
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")
|
||||
public void testSecondaryConstructor() throws Exception {
|
||||
runTest("js/js.translator/testData/box/jsName/secondaryConstructor.kt");
|
||||
|
||||
+5
@@ -5348,6 +5348,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
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")
|
||||
public void testSecondaryConstructor() throws Exception {
|
||||
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"
|
||||
}
|
||||
Reference in New Issue
Block a user