Load default values for annotation members from classfiles

so that defaults are available to synthetic implementations.

#KT-48181 Fixed

Implementation is for JVM IR; other backends & FIR need to be supported
separately.
This commit is contained in:
Leonid Startsev
2021-11-19 15:32:28 +03:00
committed by Space
parent e8868a2eff
commit 767c570af4
18 changed files with 339 additions and 109 deletions
@@ -1,4 +1,6 @@
// ALLOW_AST_ACCESS
// NO_CHECK_SOURCE_VS_BINARY
//^ While compiling source, we do not store annotation default values, but we load them when reading compiled files
package test
annotation class Anno(val value: String = "0", val x: Int = 0)
@@ -2,9 +2,9 @@ package test
public final annotation class Anno : kotlin.Annotation {
/*primary*/ public constructor Anno(/*0*/ value: kotlin.String = ..., /*1*/ x: kotlin.Int = ...)
public final val value: kotlin.String
public final val value: kotlin.String = "0"
public final fun <get-value>(): kotlin.String
public final val x: kotlin.Int
public final val x: kotlin.Int = 0
public final fun <get-x>(): kotlin.Int
}
@@ -1,4 +1,6 @@
//ALLOW_AST_ACCESS
// NO_CHECK_SOURCE_VS_BINARY
//^ While compiling source, we do not store annotation default values, but we load them when reading compiled files
package test
@Target(AnnotationTarget.TYPEALIAS)
@@ -2,7 +2,7 @@ package test
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPEALIAS}) public final annotation class Ann : kotlin.Annotation {
/*primary*/ public constructor Ann(/*0*/ value: kotlin.String = ...)
public final val value: kotlin.String
public final val value: kotlin.String = ""
public final fun <get-value>(): kotlin.String
}
@test.Ann public typealias A1 = kotlin.String