简体   繁体   中英

Kotlin 'unsafe call on nullable receiver' compile error after null check

This is the screenshot of the error: 错误截图

I'm using Intellij v14.0.1 + Kotlin plugin v0.9.206. My understanding is that after the null check, the compiler shouldn't show me the error. Am I wrong?

target属性是var ,这就是为什么它不保证在第三行上这个属性不能为null(例如另一个线程可以将它设置为null

AFAIK, a property can be a method call and then nothing can be guaranteed. Use a local val .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM