Рефлексия и сравнение типов | Kotlin

Пытаюсь сравнить типы полей, но что-то не получается.

val f: Field = T::class.java.getDeclaredField(field)
Log.i("DataShell", "${f.genericType} and ${MutableList::class.java} " +
                    "-> ${f.genericType is MutableList<*>}")

25925-26072 I/DataShell: java.util.List<..models.comment.Comment> and class kotlin.collections.List -> false
25925-26072 I/DataShell: class java.lang.String and class kotlin.collections.List -> false
25925-26070 I/DataShell: java.util.List<..models.comment.Comment> and class kotlin.collections.List -> false
25925-26070 I/DataShell: class java.lang.String and class kotlin.collections.List -> false
25925-26072 I/DataShell: java.util.List<java.lang.String> and class kotlin.collections.List -> false

Пробовал использовать f.type и f.kotlinProperty, но все равно ничего не работает. Что я делаю не так?


Ответы (0 шт):