Make diagnostic for @MetaSerializable on nested annotation

K2 plugin API has a limitation that meta annotations from plugin predicates
can't be used on nested annotations because their resolve process includes supertypes
resolve, that can be affected by the plugin itself. Therefore, @MetaSerializable
can't be applied to nested annotation classes in K2, which is reflected by
this diagnostic.

For old FE, diagnostic is lowered to WARNING with deprecation message.
This commit is contained in:
Leonid Startsev
2022-11-17 16:23:22 +01:00
committed by Space Team
parent 9586bf74e0
commit f627d81d53
10 changed files with 84 additions and 0 deletions
@@ -0,0 +1,21 @@
// WITH_STDLIB
// SKIP_TXT
import kotlinx.serialization.*
@MetaSerializable
annotation class TopLevel
class MetaSerializableNestedTest {
<!META_SERIALIZABLE_NOT_APPLICABLE!>@MetaSerializable<!>
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.CLASS)
annotation class JsonComment(val comment: String)
object Nested2 {
<!META_SERIALIZABLE_NOT_APPLICABLE!>@MetaSerializable<!>
annotation class Nested3
}
@JsonComment("class_comment")
data class IntDataCommented(val i: Int)
}