问题描述
Kotlin编译器给我以下警告:
The Kotlin compiler gave me the following warning:
在这种情况下,我想禁止显示此警告.我不知道要为@Suppress
赋予什么值,而且我找不到关于@Suppress
所接受的值的任何文档.
In this case I would like to suppress this warning. I don't know what value to give to @Suppress
, however, and I can't find any documentation for what values @Suppress
accepts.
可以给@Suppress
赋值的可能是什么?
What are the possible values that can be given to @Suppress
, and what do they mean?
推荐答案
IntelliJ在这里为您提供了很好的帮助:
IntelliJ gives you nice help here:
其中添加了@Suppress("NOTHING_TO_INLINE")
来解决警告.
Which adds @Suppress("NOTHING_TO_INLINE")
to resolve the warning.
某些可能的要抑制的编译器诊断名称可以在 Errors.java 和 DefaultErrorMessages.java 即:
Some of the possible names of the compiler diagnostics to suppress can be found in Errors.java and DefaultErrorMessages.java i.e.:
REDUNDANT_MODIFIER, "Modifier ''{0}'' is redundant because ''{1}'' is present"
这篇关于在Kotlin中可以给`@ Suppress`提供哪些可能的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!