With many checkstyle checks already in place and protecting the code formatting from further degradation, I think the time has come to tackle the more serious issues.
I have added "SpotBugs" as a Maven plugin, this is a static code analyzer tool and the successor of the widely used "FindBugs". In the initial configuration it will run in Maven's "test" phase after the unit tests, report violations of the most severe kind, and not break the build. A local run shows 122 violations of this kind, they look reasonably dangerous and fairly easy to fix.
Examples are static fields which should be final but are not, assignment to static fields from instance methods (bad singleton pattern implemented in a bad way for a double-bad result

), dereference of null pointers, unreachable code, self assignment of variables, fields masking fields with the same name in a superclass, non-thread-safe static fields like DateFormat, tests for floating-point equality.
Assignment to static fields from instance methods is particularly fun, have a look at this little gem, SpotBug's category name "scary" is very appropriate for potential bugs like these:
- Code: Select all
new GlobalOptions().addTo(null);
The change is in PR #153.