Support annotations on property accessors in JS/common metadata
#KT-14529 Fixed
This commit is contained in:
@@ -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)
|
||||
// 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)
|
||||
// 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
|
||||
}
|
||||
|
||||
+6
@@ -61,6 +61,12 @@ abstract class KotlinSerializerExtensionBase(private val protocol: SerializerExt
|
||||
for (annotation in descriptor.nonSourceAnnotations) {
|
||||
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
|
||||
if (constantInitializer !is NullValue) {
|
||||
proto.setExtension(protocol.compileTimeValue, annotationSerializer.valueProto(constantInitializer).build())
|
||||
|
||||
+10
@@ -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) {
|
||||
}
|
||||
+9
@@ -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() {
|
||||
doTest("binaryRetainedAnnotation.kt")
|
||||
}
|
||||
|
||||
fun testPropertyAccessorAnnotations() {
|
||||
doTest("propertyAccessorAnnotations.kt")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,4 +152,8 @@ class KotlinJavascriptSerializerTest : TestCaseWithTmpdir() {
|
||||
fun testEnum() {
|
||||
doTest("builtinsSerializer/annotationArguments/enum.kt")
|
||||
}
|
||||
|
||||
fun testPropertyAccessorAnnotations() {
|
||||
doTest("builtinsSerializer/propertyAccessorAnnotations.kt")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class JsMetadataVersion(vararg numbers: Int) : BinaryVersion(*numbers) {
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val INSTANCE = JsMetadataVersion(1, 2, 5)
|
||||
val INSTANCE = JsMetadataVersion(1, 2, 6)
|
||||
|
||||
@JvmField
|
||||
val INVALID_VERSION = JsMetadataVersion()
|
||||
|
||||
Reference in New Issue
Block a user