dev@glassfish.java.net

FindBugs - upgrading to latest version

From: Bill Shannon <bill.shannon_at_oracle.com>
Date: Thu, 20 Jun 2013 15:11:27 -0700

Thanks again to everyone for the incredible job on FindBugs errors for
GlassFish 4.0!

Going forward, we're going to be making some changes. This message talks
about the first such change.

We need to update our use of FindBugs to the latest version. A consequence
of this update is that the new version of FindBugs finds many more bugs than
the previous version did.

The current low priority bug count is about 600. (Amazing work!) With the
new version of FindBugs, that number will go up to about 1100. Ouch. Here's
a rough breakdown of the major bug increases:

OLD NEW TYPE
 8 254 RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
 - 139 BC_UNCONFIRMED_CAST_OF_RETURN_VALUE
15 125 IS2_INCONSISTENT_SYNC

The first one is easy to fix, but relatively harmless.

The second one should be easy to fix. Presumably most of these cases aren't
checking because something else about the logic guarantees the cast will always
succeed. An assert might be the right fix for such cases.

The third one is most interesting. These bugs can be very hard to track
down when they happen to a customer, so it's good that FindBugs is helping
us find them first. Unfortunately, these bugs can also be tricky to fix.
Simply sprinkling in "synchronized" isn't always the right answer, and can
introduce deadlocks. These bugs are some of the hardest to find and hardest
to fix. Be careful.