Suppressing Error Warnings Step by Step
I want to suppress one Findbug warning ("passes a non-constant String to the execute method in the SQL statement") by entering this line before the start of the method:
@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 goes on to say that edu cannot be resolved to the type, and the attribute is undefined for the SuppressWarnings annotation type. In the findbugs documentation, I read that I need to add annotations.jar and jsr305.jar to Java Build Path (in Project Properties). But in the findbugs folder, I cannot find any .jar file. Only findbugs.xml, findbugs-excludes.xml, etc.
What should I do to get it up and running? I am using mbbbbbbbb 2.5.2 plugin.
Many thanks!
source to share
Download it and add it to your classpath:
http://www.java2s.com/Code/Jar/a/Downloadannotations201jar.htm
Or use the official maven repository:
<dependency>
<groupId>findbugs</groupId>
<artifactId>findbugs</artifactId>
<version>1.0.0</version>
</dependency>
Link: http://mvnrepository.com/artifact/findbugs/findbugs/1.0.0
Or use this maven snippet:
<dependency>
<groupId>com.kenai.nbpwr</groupId>
<artifactId>edu-umd-cs-findbugs-annotations</artifactId>
<version>unknown</version>
</dependency>
source to share