When discussing our release builds at work today, I found this article which got me thinking. The author argues that you want the latest javac for your compilations, something I agree with. There has been quite a few bugs in the compilers (see my earlier post on the IBM JDK 1.3 compiler…) warranting using the latest and greatest. Also, since the feature set of javac haven’t changed that much, you would expect it to have continously improved over time (better test suites would also add to this).
The -target parameter for javac will make it produce Java byte code of the right version. But, if you’re not targeting the latest class libraries, you certainly want to catch any problems with using new features (like the classic “new RuntimeException(cause)”) during compilation. Now, the author argues for using a new javac and replacing the boot class loader classpath with an old rt.jar.
What do you think? How do you make your release builds? I will play around with the recommendations in the article just to see how it works out. Maven1 seems to support it using the undocumented maven.compile.bootclasspath property. Ant provides the bootclasspath for the javac task.tags: Java