Java News from Thursday, May 5, 2005

David Ekholm has released RiverLayout, a free-as-in-speech (LGPL) LayoutManager designed around a page layout metaphor. According to Eckholm, "I wanted a flexible layout manager that anyone can understand intuitively. Why not mimic how text is positioned in a text editor? In an editor words flow from left to right. They are normally separated with spaces, but if you want them aligned in columns you can use tab stops. You can insert line breaks where needed and even paragraph breaks to separate sections of text."


David Hovemeyer and Bill Pugh have posted FindBugs 0.8.8, an automated open source tool for finding potential bugs in Java code. This release includes several new detectors including:

As usual, I tested FindBugs on the latest XOM code base. It didn't find anything major (though partially that's because I've repeatedly run and fixed things found by earlier versions of this tool.) It did point out a couple of unused fields, including one I'd marked as a possible deletion but hadn't yet been able to absolutely determine whether or not it was was unused. It found some dead stores to local variables as well, including one that allowed me to eliminate a line of code in a hot spot. It also pointed out a couple of places in Jaxen (which XOM references) where I need to think more seriously about whether a field should be marked transient or an interface made Serializable.

Bottom line: the better your code is, and the better a programmer you are, the less FindBugs will find. The searches it performs are relatively shallow and obvious. They tend to be things experienced Java developers already know not to do. Nonetheless, FindBugs is free and reasonably easy to use, despite a few GUI glitches. It's worth running across your code base every so often. Sometimes even if FindBugs doesn't find anything, inspecting its output will cause you to notice things you'd missed before. FindBugs requires Java 1.4 or later and is published under the LGPL.