Exception transparency

Neal Gafter neal at gafter.com
Wed Jun 9 07:10:06 PDT 2010


On Wed, Jun 9, 2010 at 3:06 AM, Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> wrote:

> To be clearer, what I mean is, given the following declarations:
>
> class Foo<throws E> { ... }
>
> Foo<throws MyException> foo1 = ... //1
> Foo<MyException> foo2 = ... //2
> foo1 = foo2; //3
>
> *) What is the type parameter of Foo in (1) ? A disjunctive type having one
> component (of type MyException)? Or a straight type-parameter (non
> disjunctive) of type MyException?
>

If you're asking me, then I'd say those should be defined as being the same
thing.


> *) is (2) allowed? If so what is the semantics? Does the singleton type
> MyException get converted into a disjunctive type having just one component
> (of type MyException)?
>

Or vice versa (they mean the same thing).  Or to put it another way, my
suggestion is that "throws" doesn't mean anything to the type system, it is
just a syntactic mechanism to disambiguate certain syntactic constructs in
which disjuctive type arguments (more or fewer than one) are used.


More information about the lambda-dev mailing list