【发布时间】:2015-09-02 21:17:25
【问题描述】:
我知道我可以抑制来自 IntelliJ IDEA 检查的警告:
@SuppressWarnings("CollectionDeclaredAsConcreteClass")
public PropertiesExpander(Properties properties) {
this.properties.putAll(properties);
}
对于来自外部的人,可能不清楚哪个工具需要这种抑制。
PMD 为此使用前缀:
@SuppressWarnings("PMD.UnusedLocalVariable")
FindBugs 使用专用注解:
@SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
有什么方法可以明确表明这种抑制只是针对 IntelliJ IDEA 的?
【问题讨论】:
标签: java intellij-idea suppress-warnings code-inspection