By spm2ot
via sw-engineering-candies.com
Published: Jul 26 2012 / 05:11
In the first three posts of this series (see links below) mainly basic, database, security & exception handling related warnings of FindBugs™ have been described by simple code samples.
Here JSR-305 related (@Nonnull and @CheckReturnValue) warnings of FindBugs™ are in the center of attention. The following 3 warnings are covered in this article:
NP_NONNULL_RETURN_VIOLATION
NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE
RV_RETURN_VALUE_IGNORED
For static code analysis tools it is sometimes difficult to correctly detect not null usage. With JSR-305 the developer can help Findbugs in the analysis. I strongly recommend to check each possible NullPointerException, but sometimes it is a good idea not to suppress each unexpected behavior.
Nathaniel Ayewah and William Pugh [1] said: "Mistakes that manifest themselves by throwing exceptions are generally preferable to manifestations that silently and occasionally generate corrupted data or performance bottlenecks." ....
Add your comment