java 所有 SuppressWarnings 值?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2037326/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 19:04:10  来源:igfitidea点击:

all SuppressWarnings values?

java

提问by ajsie

would be great if there is a list with all values one can use with @SuppressWarnings in java.

如果有一个包含所有值的列表,可以在 java 中与 @SuppressWarnings 一起使用,那就太好了。

if these values are dependent on the compiler lets say ant in netbeans. shouldn't ant then provide a full list of all supported values?

如果这些值依赖于编译器,可以说 netbeans 中的 ant。ant 不应该提供所有支持值的完整列表吗?

回答by n002213f

Here; http://www.breakitdownblog.com/supported-values-for-suppresswarnings/. Note these are for main Java libraries; other APIs might have their own.

这里; http://www.breakitdownblog.com/supported-values-for-suppresswarnings/。请注意,这些是针对主要 Java 库的;其他 API 可能有自己的 API。

  • allto suppress all warnings
  • boxingto suppress warnings relative to boxing/unboxing operations
  • castto suppress warnings relative to cast operations
  • dep-annto suppress warnings relative to deprecated annotation
  • deprecationto suppress warnings relative to deprecation
  • fallthroughto suppress warnings relative to missing breaks in switch statements
  • finallyto suppress warnings relative to finally block that don't return
  • hidingto suppress warnings relative to locals that hide variable
  • incomplete-switchto suppress warnings relative to missing entries in a switch statement (enum case)
  • nlsto suppress warnings relative to non-nls string literals
  • nullto suppress warnings relative to null analysis
  • rawtypesto suppress warnings relative to un-specific types when using generics on class params
  • restrictionto suppress warnings relative to usage of discouraged or forbidden references
  • serialto suppress warnings relative to missing serialVersionUID field for a serializable class
  • static-accessto suppress warnings relative to incorrect static access
  • synthetic-accessto suppress warnings relative to unoptimized access from inner classes
  • uncheckedto suppress warnings relative to unchecked operations
  • unqualified-field-accessto suppress warnings relative to field access unqualified
  • unusedto suppress warnings relative to unused code
  • all抑制所有警告
  • 装箱以抑制与装箱/拆箱操作相关的警告
  • 强制转换以抑制与强制转换操作相关的警告
  • dep-ann抑制与已弃用注释相关的警告
  • 弃用以抑制相对于弃用的警告
  • fallthrough以抑制与 switch 语句中缺少中断相关的警告
  • finally抑制相对于不返回的 finally 块的警告
  • 隐藏以抑制相对于隐藏变量的本地人的警告
  • 不完整切换以抑制与 switch 语句中缺少条目相关的警告(枚举案例)
  • nls抑制相对于非 nls 字符串文字的警告
  • null抑制与 null 分析相关的警告
  • 在类参数上使用泛型时,rawtypes抑制与非特定类型相关的警告
  • 限制抑制与使用不鼓励或禁止的引用相关的警告
  • 串行以抑制与可序列化类的缺失 serialVersionUID 字段相关的警告
  • 静态访问以抑制与不正确的静态访问相关的警告
  • 合成访问以抑制与来自内部类的未优化访问相关的警告
  • 未选中以抑制与未选中操作相关的警告
  • unqualified-field-access抑制与字段访问不合格相关的警告
  • 未使用以抑制与未使用代码相关的警告

回答by Gaim

Look at Javac compiler documentation, Xlintoption. All these could be disabled by @SuppressWarnings

查看Javac 编译器文档Xlint选项。所有这些都可以被禁用@SuppressWarnings

回答by bmargulies

There cannot be. These are extensible. For example, PMDrespects @SuppressWarning("PMD").

不可能有。这些是可扩展的。例如,PMD尊重@SuppressWarning("PMD").