Do annotation type parameters get serialized? I'm ...
# compiler
y
Do annotation type parameters get serialized? I'm asking because I want to do crazy things with the type attribute extension, but it's forced to save things into annotations. Since this is legal Kotlin:
Copy code
@Target(AnnotationTarget.TYPE)
annotation class Foo<C: Any>
fun <T> bar() : @Foo<T> Bar
I'm wondering if the
@Foo<T>
, and especially the
T
part, will survive serialization and deserialization. If so, then I can easily have a cone attribute that includes that generic.
Digging around in the compiler, it seems like the answer is now. At least it's a somewhat useful user-facing way to get such a reference. I could probably turn it into something horrible when the attribute turns into an annotation (probably by using numbers to reference the type parameters, alongside some reference to what function it came from), and I can maybe deserialize that reasonably well (although I don't see how I can get a reference to the relevant function to access its type parameter.
FirAnnotation
seems to have no way "up" the declaration hierarchy)