This is the second part of the "Howto write a FindBugs Bug Detector" (see the first part here). To understand why one would write the kind of detector mentioned here, you should read the first part if you do not already know it.
Last time I presented a detector that is able to detect static
fields of the types java.util.Calendar
and
java.text.DateFormat
. While declaring fields like
this may be suspicious, there is not necessarily something wrong
with the code. The real danger comes from calling methods on
suchlike fields, especially if they are not synchronized to
protect them against concurrent access. So in this article we
will extend and improve the existing detector to cope with this
problem.
Something to chew on
This a simple class that uses a static Calendar instance. It does not …
[Read more]