kotlin Smart cast to 'Int' is impossible, because 'xxx' is a mutable property that could have been changed by this time
var xxx:Int?=null
声明了一个可能为空的整数xxx,这里的?号是将整数自动装箱为对象
当需要用到这个变量时,比如 xxx+5 就会报这个错,因为top此时是对象 ,而5是基本数据类型,xxx是有可能为空的,所以这时候是没法相加的,解决办法
var finalxxx= if(xxx==null) 5 else xxx?.let { it+5}
这样就算xxx 是null,finalxxx也是5;