简体   繁体   中英

FindBugs and annotations in Eclipse

I've tagged a method in my code with javax.annotation.CheckForNull and use it, without checking for null , in another place. When I run this code through FindBugs in Eclipse (via the plugin), there is no warning though.

Assuming there should be a warning (if not, what's a good test case?), why is it not showing?

It does show other warnings, not related to annotations.

I think the answer you're looking for can be found in here: Findbugs using jsr305 annotations in eclipse is not finding bugs

(try running findbugs outside of eclipse)

I just tested (Windows, Eclipse Helios, latest plugin) and it worked, warning of possible dereferencing of a null variable.

Perhaps check if this warning is not deactivated in your settings.

[EDIT] Tested with both javax.annotation.CheckForNull and edu.umd.cs.findbugs.annotations.CheckForNull , and both in the same class and in a class in a different package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM