Proposal: Automatic Resource Management (original) (raw)

Neal Gafter neal at gafter.com
Mon Mar 9 13:06:49 PDT 2009


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
}
}


More information about the coin-dev mailing list