The meta-annotation for adding Serializable behaviour to user-defined annotations.

Applying MetaSerializable to the annotation class A instructs the serialization plugin to treat annotation A as Serializable. In addition, all annotations marked with MetaSerializable are saved in the generated SerialDescriptor as if they are annotated with SerialInfo.

annotation class MySerializable(val data: String)

class MyData(val myData: AnotherData, val intProperty: Int, ...)

val serializer = MyData.serializer()
serializer.descriptor.annotations.filterIsInstance<MySerializable>().first().data // <- returns "some_data"

See also