I’ve written an article on the new Java SE 7 try-with-resources feature for the JavaTech Journal. This is a free PDF download. (You have to register with the site in order to get the download link.) This issue has several articles about Java SE 7, which will be released in the summer.
The article covers exception handling in Java SE 6 and earlier and what made it tedious and error-prone, the new try-with-resources feature and what it does, and the multiple resources variant and how it solves exception handling issues with wrapped resources.
This article was informed by the “Coinification” work I had done in JDK 7. I had previously converted some JDK 7 code to use diamond, and I had blogged about it here and here. I had also converted some code to use try-with-resources and the more precise rethrow features of Project Coin, but I haven’t blogged about it, mainly because most of my writing effort was focused on the JTJ article. Now that it’s been published, I’ll be writing more here about these features, and I’ll cover some of the finer points that didn’t make it into the article. Meanwhile, download and read the latest JTJ issue. You can also download preview binaries, sources, and documentation for JDK7 here.
Enjoy!
Leave a Reply