【问题标题】:Is there a class annotation in FindBugs to ignore all warning in a fileFindBugs 中是否有一个类注释来忽略文件中的所有警告
【发布时间】:2012-11-15 13:41:45
【问题描述】:

在 FindBugs 中有一个注释可以忽略一组错误, 例如:

import edu.umd.cs.findbugs.annotations.SuppressWarnings;
@SuppressWarnings(value="DLS_DEAD_LOCAL_STORE", justification="...")

有没有办法忽略 java 文件的所有类型的错误, 使用注解?

我知道可以从命令行或配置文件中排除文件: http://findbugs.sourceforge.net/manual/filter.html

但对于这种特殊情况,我需要定义此排除项,仅修改该 java 文件。

【问题讨论】:

    标签: findbugs


    【解决方案1】:

    value 属性使用带有空字符串的标准注释。

    @SuppressWarnings(value = "")
    

    如果您使用@SuppressFBWarnings 而不是@SuppressWarnings 以避免与java.lang.SuppressWarnings 混淆并允许在IDE 中自动导入,您甚至可以完全省略value 属性。

    @SuppressFBWarnings
    

    【讨论】:

      猜你喜欢
      • 2010-12-22
      • 1970-01-01
      • 2011-01-12
      • 2012-06-27
      • 1970-01-01
      • 2015-02-25
      • 2011-12-15
      • 2017-02-15
      • 1970-01-01
      相关资源
      最近更新 更多