UncheckedIOException and suppressed exception

Zhong Yu zhong.j.yu at gmail.com
Mon Feb 4 16:16:11 PST 2013

Suppose we have an UncheckedIOException e1, which wraps an IOException
e2. Then another exception e3 occurs that we want suppress. Should we
do e1.addSuppressed(e3), or e2.addSuppressed(e3)? That's pretty

If UncheckedIOException is not a *real* exception, maybe we should
make it a "control" exception. It should have no stacktrace; it should
have no cause (the wrapped exception is not a cause); it should not
contain suppressed exceptions.

Maybe it can override addSuppressed() to forward suppressed exceptions
to the wrapped exception. (Though addSuppressed() is `final`, there's
no problem to leave a backdoor for another JDK class)

Zhong Yu

More information about the lambda-dev mailing list