The Philosophy of Nothing
Peter Levart
peter.levart at gmail.com
Sat Dec 5 02:46:47 PST 2009
On Wednesday 02 December 2009 17:45:19 Reinier Zwitserloot wrote:
> The 'throws' clause of any method declaration lists *CHECKED* exceptions
> that you can't throw. Thus, "throws Nothing" indicates that the method may
> throw any unchecked exception, like all methods can, and may also throw any
> instance of Nothing.
>
> That last bit is trivially true for two reasons:
>
> 1. There are no instances of nothing. Therefore, granting any method the
> ability to throw instances of Nothing is irrelevant.
>
> 2. Nothing is an unchecked exception type, as it is a subtype of either
> RuntimeException or Error (it is in fact, both - Nothing is a subtype of
> everything). This is consistent with existing spec, see JLS 11.2:
> http://java.sun.com/docs/books/jls/second_edition/html/exceptions.doc.html#
> 44121
>
and
3. Nothing is also a checked exception type, as it is as subtype of say IOException, which is a
checked exception (unless the definition of checked exceptions in new JLS excludes Nothing from
checked exceptions types). :-)
Peter
More information about the closures-dev
mailing list