How are generic annotations' type parameters store...
# compiler
z
How are generic annotations' type parameters stored in metadata? I'm trying to resolve them at runtime with kotlin-reflect but finding that this information appears to always be missing and unavailable in kotlinx-metadata
m
They aren't stored unfortunately.
z
Interesting, as I’m able to read them from an IR plugin
m
Before or after deserialization? The compiler has the information for currently compiled declarations, but the type argument information is lost if you look up already compiled declarations (from different modules or other incremental compilation rounds). I had to add super hacky workarounds to my compiler plugin because it relies on annotations with type arguments. Basically I store all types(parameter types, return types) of the declaration (function, property, class) in a json string and add a annotation with the json string to the declaration itself. Then later in different compilations I can read the annotation with the correct types. You can check it out here: https://github.com/IVIanuu/injekt/blob/master/compiler/src/main/kotlin/com/ivianuu/injekt/compiler/frontend/InfoPatcher.kt
z
Ahh good point, I guess this would be before serialization