harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Wilson <jessewil...@google.com>
Subject Re: SneakyThrow!
Date Tue, 17 Nov 2009 16:33:51 GMT
On Tue, Nov 17, 2009 at 7:56 AM, Tim Ellison <t.p.ellison@gmail.com> wrote:

> The difference I see, by just staring at the code and without running
> it, is that if the 'thrown' Throwable that was caught earlier is not one
> of the tested types (IOException | RuntimeException | Error) then the
> original code throws an AssertionError, whereas sneaky will re-throw the
> raised type.
> Not sure why the original has AssertionError...

Yeah, the repeated "throw" statements in that code obscured my intentions.

"throw new AssertionError()" is idiomatic for lines of code that should
never ever be executed. In this case, IOException, RuntimeException and
Error were the only things that could have been thrown by the try blocks.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message