admin管理员组文章数量:1550365
Why does Android Studio indicate that an object might be null when it cannot be?
Because lint cannot know. document.exists() can return null in general and that's why you see the warning. Lint performs basic checks and doesn't know the details about the Firebase API. You can even reproduce this behaviour with the Java Core API.
How can I solve this without checking for nullity? Thanks!
If you are 100% sure that it can never be null, you can use
@SuppressWarnings("ConstantConditions")
But I would not recommend that, because you don't know if the Firebase API will change in the future. Maybe the next version of Firebase will allow null returns.
版权声明:本文标题:android indicate,Why does Android Studio indicate that an object might be null when it cannot be? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1727245812a1104610.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论