美文网首页
Kotlin中方法调用参数可能为null得正确写法

Kotlin中方法调用参数可能为null得正确写法

作者: tommyRen | 来源:发表于2019-03-28 10:52 被阅读0次

编译错误信息如下:

Smart cast to 'Node' is impossible, because 'left' is a mutable property that could have been changed by this time

Smart cast to 'xxxx' is impossible, because 'xxxx' is a property that has open or custom getter

例如下边这行代码 

解决方法:1:是使用本地变量。 2:使用safe call 安全调用。 3: Elvis操作符 

相关文章

网友评论

      本文标题:Kotlin中方法调用参数可能为null得正确写法

      本文链接:https://www.haomeiwen.com/subject/ergfbqtx.html