android - @VisibleForTesting 在 Kotlin 中?

标签 android kotlin lint

我在 Kotlin 类的公共(public)属性上添加了 @VisibleForTesting,然后在不应允许的地方使用它,但我的 lint 检查成功通过。我应该避免在 Kotlin 中使用 @VisibleForTesting 吗?这是一个安卓项目。

最佳答案

这似乎是一个错误。我开了一个bug report描述问题。据我所知,这只会影响属性访问。在您的情况下,一种解决方法是使用常规函数调用。

关于android - @VisibleForTesting 在 Kotlin 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57818872/

相关文章:

flutter - 异步等待 Navigator.push() - 出现 linter 警告 : use_build_context_synchronously

android - 使用改造缓存特定响应

android - 设置值时复选框的视觉状态未更新

java - Kotlin 比 java 更难逆向工程吗

apache-spark - Kotlin 从 cli 编译 - Unresolved reference

java - 当我为 Lint 实现自定义检测器时如何调试 java 源代码?

Android P2P 服务发现回调未被调用

android - 平板电脑屏幕方向更改 - 未找到 fragment ID 的 View

android - 如何将 ViewBinding 与 RecyclerView Adapter 与 Kotlin 中已有的内部类一起使用?

JavaScript Lint inc_dec_within_stmt 警告