zoukankan      html  css  js  c++  java
  • 如何忽略Findbugs的bug

    如何忽略Findbugs的bug

    除了用xml的形式去忽略一些文件和bug。最好用的还是注解:

    下面的方法会有MT_CORRECTNESS和STYLE的bug。注解忽略方法为:

    
        @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
            value = {"MT_CORRECTNESS", "STYLE"},
            justification = "I know what I'm doing")
        public JdbcTemplate get(String datasourceName) {
            JdbcTemplate jdbcTemplate = TEMPLATE.get(datasourceName);
            if (jdbcTemplate == null) {
                synchronized (this) {
                    if (jdbcTemplate == null) {
                        jdbcTemplate = createTemplate(datasourceName);
                        TEMPLATE.put(datasourceName, jdbcTemplate);
                    }
    
                    return jdbcTemplate;
                }
            }
    
            return jdbcTemplate;
        }
    

    需要添加以下依赖

    <dependency>
        <groupId>com.google.code.findbugs</groupId>
        <artifactId>annotations</artifactId>
        <version>3.0.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.google.code.findbugs</groupId>
        <artifactId>jsr305</artifactId>
        <version>3.0.1</version>
        <scope>provided</scope>
    </dependency>
    
  • 相关阅读:
    添加yum源
    tar命令
    tomcat压力测试、优化
    vi命令
    Linux简单命令
    Linux简单命令
    vi命令
    tomcat压力测试、优化
    tar命令
    动态加载 CSS 文件
  • 原文地址:https://www.cnblogs.com/woshimrf/p/ignore-findbugs.html
Copyright © 2011-2022 走看看