hg: lambda/lambda/jdk: Add BufferedReader.lines

Zhong Yu zhong.j.yu at gmail.com
Sun Nov 11 19:37:24 PST 2012


On Sun, Nov 11, 2012 at 5:11 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
>> Brian,
>> UncheckedIOException already exists, it's IOError.
>
> That exists, but is something different.
>
> IOError implements Error, which is intended to indicate an error
> situation from which the VM cannot recover.  It was added to support
> Console, for which using Error is arguably OK.  But here, an IOException
> is clearly NOT an Error.
>
> Our choices where creating this class or wrapping it in an ordinary
> RuntimeException.  Because we anticipated other cases with IO-backed
> streams, we thought we'd get additional mileage out of this class.

UncheckedIOException would also be useful in many applications where
IO exceptions aren't expected to occur, and it would have been better
if they are unchecked. Now programmers can use UncheckedIOException to
convert IO exceptions to uncheck exceptions.

However, why not have a general UncheckedException, so that we don't
need to invent UncheckSQLException, UncheckedReflectionException etc.
We can use RuntimeException as the wrapper now, but a dedicated
UncheckedException can be more clear that this is just a wrapper of
the actual exception.

Zhong Yu


More information about the lambda-dev mailing list