Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Suppress 注解可以用的 names #39

Open
Kazusa1412 opened this issue Jun 28, 2021 · 2 comments
Open

@Suppress 注解可以用的 names #39

Kazusa1412 opened this issue Jun 28, 2021 · 2 comments

Comments

@Kazusa1412
Copy link

在 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参数的信息,不过我测试过并不是全部都能生效的。

视频快水起来

@bennyhuo
Copy link
Owner

bennyhuo commented Aug 3, 2021

已加入排期

@yasuofenglei
Copy link

同问

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants