[英]Suppressing findbugs warning Step by Step
I want to suppress a single Findbug warning ("passes a nonconstant String to an execute method on an SQL statement") by entering this line before the beginning of the method: 我想通过在方法开头之前输入以下行来抑制单个Findbug警告(“将非常量字符串传递给SQL语句上的execute方法”):
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = {"SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE", "SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING" }, justification = "just a test")
But Eclipse keeps saying that edu cannot be resolved to a type and The attribute justification is undefined for the annotation type SuppressWarnings. 但Eclipse一直说edu无法解析为类型,并且注释类型SuppressWarnings的属性对齐未定义。 In the findbugs documentation i read that I have to add the annotations.jar and jsr305.jar in Java Build Path (in Project Propertes).
在findbugs文档中,我读到我必须在Java Build Path中添加annotations.jar和jsr305.jar(在Project Properties中)。 But in the findbugs folder I cant find any .jar file.
但是在findbugs文件夹中我找不到任何.jar文件。 Only findbugs.xml, findbugs-excludes.xml and so on.
只有findbugs.xml,findbugs-excludes.xml等等。
What can I do to get this running? 我该怎么做才能让它运转起来? I Use Findbugs maven plugin 2.5.2.
我使用Findbugs maven插件2.5.2。
Thank you very much! 非常感谢你!
Download it and add to your classpath: 下载并添加到您的类路径:
http://www.java2s.com/Code/Jar/a/Downloadannotations201jar.htm
Or use the official maven repository: 或者使用官方maven存储库:
<dependency>
<groupId>findbugs</groupId>
<artifactId>findbugs</artifactId>
<version>1.0.0</version>
</dependency>
Link: http://mvnrepository.com/artifact/findbugs/findbugs/1.0.0 链接: http : //mvnrepository.com/artifact/findbugs/findbugs/1.0.0
Or use this maven snippet: 或者使用这个maven片段:
<dependency>
<groupId>com.kenai.nbpwr</groupId>
<artifactId>edu-umd-cs-findbugs-annotations</artifactId>
<version>unknown</version>
</dependency>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.