Java News from Saturday, September 17, 2005

Tom Copeland has released PMD 3.3, an open source tool for automatically checking Java code for various classes of bugs. Version 3.3 adds seven new rules:

I tested this release out on XOM. This time it didn't locate any real bugs. It found a couple of places where I was making unnecessary checks for null values before an instanceof. The new rules also flagged many places where I was writing s.equals("literal") instead of "literal".equals(s) though none of those seemed to be actual bugs. (I'm pretty rigorous about checking for and avoiding null in my variables.) It also noted a few places where I could eliminate a local variable; and there were several string literals it wanted replaced with constant fields. However, the switch statement rules generated lots of false positives because XOM uses lots of switch statements in very precise but unusual ways.