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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The FindBugs initial approach involves XML configuration files aka filters. This is really less convenient than the PMD solution but FindBugs works on bytecode, not on the source code, so comments are obviously not an option. Example:
However, to solve this issue, FindBugs later introduced another solution based on annotations (see
SuppressFBWarnings) that you can use at the class or at the method level (more convenient than XML in my opinion). Example (maybe not the best one but, well, it’s just an example):Note that since FindBugs 3.0.0
SuppressWarningshas been deprecated in favor of@SuppressFBWarningsbecause of the name clash with Java’sSuppressWarnings.