Proposal: Automatic Resource Management (original) (raw)
Mark Mahieu markmahieu at googlemail.com
Mon Mar 9 16:17:55 PDT 2009
- Previous message: Proposal: Automatic Resource Management
- Next message: Proposal: Automatic Resource Management
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Yuck.
I guess one way to deal with this would be to track exceptions
'definitely thrown' by statements, and use different translations
depending on whether there are any exceptions 'definitely' thrown by
the body. Not exactly a trivial addition to the spec though.
Mark
On 9 Mar 2009, at 20:06, Neal Gafter wrote:
On Mon, Mar 9, 2009 at 11:16 AM, Joshua Bloch <jjb at google.com> wrote:
This URL should always point at the latest version: http://docs.google.com/Doc?id=ddv8ts740vnstdfdh The static exception analysis implied by the proposal's translation doesn't match its dynamic semantics. In the following program snippet, the proposal requires an error message where shown, while the dynamic semantics never allow the reported exception to occur. static BufferedReader getReader(String name) { // any implementation here } public static void main(String[] args) { { try (BufferedReader localVar = getReader(args[0])) { throw new NullPointerException(args[0]); } // required language error: IOException not caught } }
- Previous message: Proposal: Automatic Resource Management
- Next message: Proposal: Automatic Resource Management
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]