Justin
06/25/2020, 10:18 PMannotation class DynamicAnnotation(val type: String)
that somehow applies one of two existing annotations based on the passed type parameter?
Specifically, I want to do something like this:
val annotation = "Serializable" // or, "JsExport"
@DynamicAnnotation(annotation)
data class User(val id: String)
...such that when the annotation
string is set to "JsExport"
, it will generate:
@JsExport data class User(val id: String)
And when it's set to "Serializable"
, it will generate:
@Serializable data class User(val id: String)
This is to deal with a known bug in Kotlin 1.4-M2 and kotlinx.serialization (you can't have classes annotated with Serializable and JsExport for some reason).
Any ideas?