Is there a way to ignore a single FindBugs warning?

后端 未结 7 1720
误落风尘
误落风尘 2020-11-28 21:40

With PMD, if you want to ignore a specific warning, you can use // NOPMD to have that line be ignored.

Is there something similar for FindBugs?

相关标签:
7条回答
  • 2020-11-28 22:29

    Update Gradle

    dependencies {
        compile group: 'findbugs', name: 'findbugs', version: '1.0.0'
    }
    

    Locate the FindBugs Report

    file:///Users/your_user/IdeaProjects/projectname/build/reports/findbugs/main.html

    Find the specific message

    Import the correct version of the annotation

    import edu.umd.cs.findbugs.annotations.SuppressWarnings;
    

    Add the annotation directly above the offending code

    @SuppressWarnings("OUT_OF_RANGE_ARRAY_INDEX")
    

    See here for more info: findbugs Spring Annotation

    0 讨论(0)
提交回复
热议问题