Unnecessary close in try-with-resources

MSAL

Remove close() calls at the end of a try-with-resources block that close the last declared resource, when that resource is a java.io.Closeable, whose close() has no effect once the resource is already closed. A close() in any other position, or on any other resource, is left in place, because removing it would change when, or in what order, resources are closed.

org.openrewrite.staticanalysis.UnnecessaryCloseInTryWithResources
mod run . --recipe=org.openrewrite.staticanalysis.UnnecessaryCloseInTryWithResources

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.