kotlin获取泛型参数反射创建对象实例

Java

((this.javaClass.genericSuperclass as? ParameterizedType)?.actualTypeArguments?.get(0) as? Class<T>)?.newInstance()

Kotlin

val newInstance = this::class.supertypes.first().arguments.first().type?.javaClass?.newInstance()
    print("..TestLinerHorListView.$newInstance")

获取泛型类型

new TypeReference<ArrayList<Feed>>() {}.getType()

反射创建带构造实例