对于用Kotlin编写的应用程序,我使用带反号的方法名进行测试,如下所示:

fun `API login error - don't save token or user`() {

It works, the tests compile and work without a problem, but Lint in Android Studio is marking those methods as error with message Identifier not allowed in Android.

Is there any way to suppress this so that the Lint check passes without errors and it's not marked with red underline in Android Studio?

推荐答案

I am not sure if you can do it in code, but you can at least disable it in the IDE. Go to "File | Settings | Editor | Inspections | Illegal Android Identifier" and disable this inspection.

Kotlin相关问答推荐

如何在 Big Data 中使用Inc过滤器?

新的jOOQ Gradle插件无法正确处理自引用关系

为什么 Kotlin 中没有 init 块的注释

在 Kotlin 中将两个字节转换为 UIn16

Webpack 配置未应用于 kotlin 多平台react 项目

kotlin 父类具有依赖于抽象变量的变量

Kotlin 启动与启动(Dispatchers.Default)

测试协程和线程之间的差异,我在kotlin中使用线程时无法得到OOM错误

如何创建扩展函数isNullOrEmpty?

Mixin 在 Jackson 中添加 defaultImpl 不起作用

将子元素放在一个列表中

伴随对象在变量更改时更改它的值

为什么我们在 kotlin 中需要 noinline?

Kotlin:找不到符号类片段或其他 android 类

Tornadofx - 如何在每个实例上将参数传递给 Fragment

这是 Kotlin 中的错误还是我遗漏了什么?

如何在Kotlin中使方法param可变?

Kotlin 与 C# 中的标志枚举变量具有相似效果的方式是什么

Kotlin var lazy init

Kotlin中的嵌套let块