A problem with formatting code on a branch, is when you come to merge it back to the trunk, you end up having to work thorough lots of file changes which are really only formatting changes. The larger your project size, the more work this involves. I was faced with a similar task recently.
While editing file by file, I usually do the Ctrl-A Ctrl-Shift-F combo to ensure the file is formatted according to our corporate standards before saving any edits. Since much of the code I touched on the branch was formatted under a different standard, and I touched a lot of files while introducing log4j logging, the end result was heading for a hairy merge. What I really needed was a way to bulk format both the branch and the trunk versions of the code-base.
Luckily, I realised that that same formatter embedded in Eclipse can be used to bulk format Java source. Here’s how …
As I’ve mentioned before, I run Ubuntu on an AMD64 processor. I was recently surprised to see that running the new release of Eclipse (Europa) was causing me issues. Basically, Java (or the native parts of these projects) was throwing a wobbly when trying to run 32-bit code on a 64-bit JVM. I thought the goal of Java was write once, run anywhere!
It took me a while, but I managed to find a 64-bit install of Europa. You have to take the “Eclipse Classic” SDK version for Linux x86_64. This installed and ran using the default instructions provided (unzip and run).
Netbeans 6.0M9 gave me similar issues a while back. I never got around to fixing it, but I noticed yesterday that 6.0M10 has been released. This installed and ran straight away. I guess they’ve included x86_64 support in the installer now.
I got no excuses for not developing something useful now :-)