How can I suppress unchecked cast warnings?

前端 未结 1 1012
暗喜
暗喜 2020-11-30 11:09

Having the following code:

fun doSomething(): List {

    val test: List<*> = arrayListOf(\"test1\", \"test2\")

    return test as List&         


        
相关标签:
1条回答
  • 2020-11-30 11:40

    Adding @Suppress("UNCHECKED_CAST") (also possible through IDEA's Alt+Enter menu) to any of statement, function, class and file should help.

    Before:

    After:

    0 讨论(0)
提交回复
热议问题