我正在编写一个执行智能类型转换的方法-如果类型参数恰好是字符串,则使用ToString(),否则进行强制转换,但如果强制转换不起作用,则返回null。基本上可以从v中获取尽可能多的信息,而不会抛出异常。在尝试强制转换之前,我检查了T确实是一个string,但是编译器仍然不喜欢:
Cannot convert type 'string
mRecyclerView.findViewHolderForAdapterPosition(i) as EffectsHolder }kotlin.TypeCastException: null cannot be cast to non-null type com.mobileer.androidfxlab.EffectsAdapter.EffectsHolder如果mRecyclerView.findViewHolde