Exception transparency - lone throws (no checked exceptions)

Florian Weimer fweimer at bfk.de
Thu Jun 10 10:03:02 PDT 2010


* Alex Blewitt:

> How could this work in the face of subclasing?

I guess the goal is to put

  void close() throws;

into java.io.Closeable, and still retain source-level compatibility.

> What if I invoke that abstract method - what types am I expecting to
> catch?

When a block calls a throws method, checks for checked exceptions are
disabled for this block.  This is required because otherwise, existing
client code would not compile anymore.

A block which does not call such a method needs to use a catch-throws
clause.  Previously, it could not catch those exceptions, so there
isn't a compatibility issue.

-- 
Florian Weimer                <fweimer at bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99


More information about the lambda-dev mailing list