Exception transparency - lone throws (no checked exceptions)
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Tue Jun 15 01:13:18 PDT 2010
On 15/06/10 00:54, Nathan Bryant wrote:
> Under exception transparency, how will "throws nothing" be declared?
>
> public void foo(Bar<E> bar) throws E;
>
> new Bar<RuntimeException>() would of course work, but seems...
> idiomatic.
>
> Is new Bar<void>() legal?
>
>
Hi
'void' seems to be the natural choice for denoting 0-arguments
disjunctive types. There are some problems though (e.g. conflicts with
the InvokeDynamic.<void>invoke() syntax), however I'm working to resolve
these issues (i.e. 'void' as a type-parameter is only allowed if the
corresponding type-variable is a throw type-variable).
Other possible choices are:
*) ... (varargs syntax)
*) new synthetic type (e.g. Nil) --- similar to BGGA
Currently 'void' is our first choice - however it is easy enough to
switch between the alternatives above (only requires a simple parser
change).
Maurizio
More information about the lambda-dev
mailing list