A nice feature of the Java 7 try-with-resources statement and the AutoCloseable type that was introduced to work with this statement is the fact that static code analysis tools can detect resource leaks. For instance, Eclipse: When you have the above configuration and you try running the following program, you'll get three warnings: public static … Continue reading A Subtle AutoCloseable Contract Change Between Java 7 and Java 8