I am looking into using FindBugs to help find obvious bugs in my code.
I understand that any tool is limited in some ways, but the two most prevalent bugs I want to look for are:
NullPointerExceptions; and- Java memory leaks
Does FindBugs have the capabilities to find these? I’m sure one is never guaranteed to have all bugs uncovered, but it would be nice if FindBugs could detect even a fraction of them right there inside of Eclipse for me.
I have been reading the HTML manual and haven’t come across anything that mentions these capabilities.
FindBugs uses static analysis to look for bugs in Java code. You could get good tips about improving your code, but it cannot guarantee you will detect memory leaks or NullPointerExceptions due to the runtime nature of both kind of problems. Certainly you will get very good tips about avoiding bad practices that could cause memory leaks and null pointers, but it is just a starting point.
Also check this question about finding memory leaks in Java.
The following Findbugs checks helps avoiding NullPointerException:
Some checks about memory issues that will help improve your code are