I’m writing an annotation processor using Kapt and...
# announcements
i
I’m writing an annotation processor using Kapt and KotlinPoet; am I correct in thinking that there is no way to detect nullability on parameterized type values? i.e. I cannot distinguish
myMap: Map<String,Any>
from
myMap: Map<String,Any?>
, because both of those turn into Java
Map<String,Object>
from the standpoint of the annotation processor. Is there any way to distinguish them? As a workaround I’m considering adding an additional annotation
@HasNullValue
but it’s a bit of a hack.
d
You can read the
kotlin.Metadata
annotation and then use
kotlinx.metadata.jvm
to parse the metadata values and obtain precise kotlin types. https://github.com/JetBrains/kotlin/tree/master/libraries/kotlinx-metadata/jvm
i
Ah! That makes sense. Skimmed right over it. Thanks!