Kotlin-Tutorials
Kotlin-Tutorials copied to clipboard
@Suppress 注解可以用的 names
在 kotlin 中 @Suppress 是一个神奇的注解,能消除编译器的警告,甚至还能消除错误,不过这个注解的参数 names 很多时候不知道该怎么写
/**
* Suppresses the given compilation warnings in the annotated element.
* @property names names of the compiler diagnostics to suppress.
*/
@Target(CLASS, ANNOTATION_CLASS, TYPE_PARAMETER, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER,
CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, TYPE, EXPRESSION, FILE, TYPEALIAS)
@Retention(SOURCE)
public annotation class Suppress(vararg val names: String)
这里 好像有这个names参数的信息,不过我测试过并不是全部都能生效的。
~~视频快水起来~~
已加入排期
同问