Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
function f(){ try { return; } catch(x) { print("Caught " + x); } finally { throw 0; } } f() This program prints "Caught 0"; it should not. The issue here is that the "throw 0" is inlined in place of the "return" statement, but the catch block still guards the whole block (with the inline finally replacement). We should inline finallies as blocks, flag them as such, and handle flagged blocks when CodeGenerator processes try/catch/finally nodes to split the exception table ranges to exclude inlined finallies (that's the same strategy javac follows).
|