Files
kotlin-fork/plugins/kotlinx-serialization/testData/diagnostics/metaSerializableNested.kt
T
Leonid Startsev f627d81d53 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.
2022-11-22 10:53:28 +00:00

22 lines
525 B
Kotlin
Vendored

// 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)
}