Open goyourfly opened 5 years ago
混淆 Kotlin 代码时碰到一个问题,类似下面多层嵌套的写法,在编译时报错
class Error { fun run() { with(Unit) { runLambda { runLambda { println("Hello, World!") } } } } private fun runLambda(lambda: () -> Unit) = lambda() }
编译报错: 有人已经给 Kotlin 团队提过这个 Bug,但是直到刚刚发布的 Kotlin: 1.3.30 版本这个 Bug 还在。
Kotlin: 1.3.30
目前能绕过去的办法有两种:
-dontwarn com.example.threadnumtest.Error$run$1$1$1
这样的嵌套看起来很糟糕啊
https://github.com/Kotlin/anko https://github.com/Kotlin/anko/issues/400 用 DSL 写布局不可避免的使用嵌套,这种混淆错误也不知道什么写法会出发,反正有的嵌套报错,有的没问题
混淆 Kotlin 代码时碰到一个问题,类似下面多层嵌套的写法,在编译时报错
编译报错: 有人已经给 Kotlin 团队提过这个 Bug,但是直到刚刚发布的
Kotlin: 1.3.30
版本这个 Bug 还在。目前能绕过去的办法有两种:
-dontwarn com.example.threadnumtest.Error$run$1$1$1
,我试了一下没有问题,但这种办法一定要在打包后充分测试