mardi 11 février 2020

How to reflect nullable fields in Kotlin

I want to check if my field is assignable from a type. In my class which I am reflecting some fields are nullable (let's say String?) but when I check it by reflection:

if(field.type.isAssignableFrom(String::class.java)) {...}

this is always false. Is it possible to reflect nullable fields in Kotlin?





Aucun commentaire:

Enregistrer un commentaire