Why a new type parameter for exception transparency?

Paul Benedict pbenedict at apache.org
Wed Nov 18 20:41:47 PST 2009


Neal,

> Perhaps another approach would be to just take the hint from the
> fact that the type parameter's bound is a checked exception type.  That is
> not strictly backward source-compatible, but it might be compatible enough
> to allow us to simplify the syntax as you suggest.

You read my mind! I was hoping you could infer it.

Anyway, if we take closures out of the discussion, I imagine the new
type is usable outside of closures, correct? For example:

public <throws E extends Exception> void throwit(E e) throws E {
   throw e;
}

But really, the compiler should know what to do just with this:

public <E extends Exception> void throwit(E e) throws E {
   throw e;
}

I might be missing something, but is there any important distinction
between the two?

Paul


More information about the closures-dev mailing list