In the try
-with-resources construct of Java 7, I can declare a resource in the try
statement, and it will be closed automatically when it goes out of scope.
However, I don't find any indication of the scope of the resource made available. Specifically, is it available in the catch
/finally
blocks of the try block where it is declared?
I tried the following in Eclipse Kepler, but it's giving a mixed impression:
Resource variable is made available by Content Assist (Code Completion):
Quick Fix suggests changing to resource variable, but this recursively produces the same problem it's trying to fix:
I would like to know what the correct scope limitation is, before raising a bug in the Eclipse Bug Tracker.