Java:@SuppressWarnings(...)参数的完整列表(在Netbeans中)?

jav*_*top 12 java netbeans compiler-warnings suppress-warnings

Netbeans提供了很多自定义的"提示",就像警告一样,只是大多数都无法被抑制(只是全局禁用IDE).

但现在我查看使用的代码

@SuppressWarnings("element-type-mismatch")
Run Code Online (Sandbox Code Playgroud)

抑制被称为"可疑方法调用"的提示/警告(例如remove(...)对于具有"错误"类型的集合).

好吧,我永远不会想到用一个SuppressWarnings叫做"元素类型不匹配" 的参数来抑制名为"可疑方法调用"的提示,但显然,它有效.

那么,这些参数是否存在"魔力列表"?

例如,我如何抑制提示/警告"收集字段的返回"?

注意:对于此类似问题,未列出"元素类型不匹配".

Sup*_*ole 13

在简要介绍了NB-sourcecode之后,我在一些java.hint -classes中找到了这些:

@Hint(category="bitwise_operations", suppressWarnings="IncompatibleBitwiseMaskOperation")
@Hint(category="initialization", suppressWarnings="LeakingThisInConstructor")
@Hint(category="logging", suppressWarnings={"NonConstantLogger"}) //NOI18N
@Hint(category="logging", suppressWarnings={"ClassWithMultipleLoggers"}) //NOI18N
@Hint(category="logging", suppressWarnings={"ClassWithoutLogger"}, enabled=false) //NOI18N
@Hint(category="code_maturity", suppressWarnings="UseOfObsoleteCollectionType")
@Hint(category="initialization", suppressWarnings="OverridableMethodCallInConstructor")
@Hint(category="bitwise_operations", suppressWarnings="PointlessBitwiseExpression")
@Hint(category="code_maturity", suppressWarnings="CallToThreadDumpStack")
@Hint(category="bitwise_operations", suppressWarnings="ShiftOutOfRange")
@Hint(category="initialization", suppressWarnings="StaticNonFinalUsedInInitialization")
@Hint(category="code_maturity", enabled = false, suppressWarnings="UseOfSystemOutOrSystemErr")
@Hint(category="code_maturity", suppressWarnings="CallToPrintStackTrace")
Run Code Online (Sandbox Code Playgroud)

显然,并非所有显示为警告的IDE提示都是可抑制的......不知道为什么会这样,因为很多提升的AbstractHint类很​​容易提供这种能力......这些只是压制名称,为了找到它们所代表的警告名称的映射,需要在源代码中进行更深入的挖掘.