try-finally with close auto-refactoring to try-with-resources with codestyle/checkstyle
<p>I am working on a codebase that has recently migrated from Java 6 to Java 7. I would like to replace constructions like this:</p>

<pre><code>Connection conn = null;
try{
    conn = new Connection();
    ...
} catch(Exception ex){
    ...
} finally{
    if (conn != null){
        conn.close();
    }
}
</code></pre>

<p>with <code>try-with-resources</code> (available from Java 1.7 onward):</p>

<pre><code>try(Connection conn = new Connection()){
    ...
} catch(Exception ex){
    ...
}
</code></pre>

<p>Is there an automated way to automatically refactor the old to the new (perhaps with the Checkstyle-plugin, or within Eclipse itself)?</p>