Exception transparency

Neal Gafter neal at gafter.com
Thu Jun 10 14:27:13 PDT 2010


On Thu, Jun 10, 2010 at 2:14 PM, Alex Buckley <alex.buckley at oracle.com>wrote:

> ...exception type arguments are not covariant...
>

An API designer using SAMs can get the effect of covarance (i.e. a method
will accept a lambda that throws fewer exceptions than the API declares) by
using wildcards heavily.  An API designer using function types gets the
variance "for free" as function types are naturally covariant in the types
of the thrown exceptions.


More information about the lambda-dev mailing list