Code review request for checked/unchecked exception clarifications
David Holmes - Sun Microsystems
David.Holmes at Sun.COM
Fri Jan 8 05:16:49 UTC 2010
Hi Peter,
Peter Jones said the following on 01/08/10 15:00:
> Hi. Another nit: the wordings below seem to imply that "new Error()" and "new RuntimeException()" (i.e. not subclasses) make checked exceptions, but of course they are unchecked too.
What wording do you think implies this?
These are quite clear:
+ * That is, {@code Error} and its subclasses are regarded as unchecked
+ * exceptions for the purposes of compile-time checking of exceptions.
+ * <p>{@code RuntimeException} and its subclasses are <em>unchecked
+ * exceptions</em>.
David
> Cheers,
> -- Peter
>
>
> On Jan 7, 2010, at 10:36 PM, Joe Darcy wrote:
>
>> David Holmes - Sun Microsystems wrote:
>>> Hi Joe,
>>>
>>> This looks fine to me.
>>>
>>> One minor consistency nit, sometimes you refer to "subclasses of" and sometimes "subclass of" eg:
>>>
>>> + * <p>The class {@code Exception} and any subclasses that are not also
>>> + * subclasses of {@link RuntimeException} are <em>checked
>>> + * exceptions</em>.
>>>
>>> + * For the purposes of compile-time checking of exceptions, {@code
>>> + * Throwable} and any subclass of {@code Throwable} that is not also a
>>> + * subclass of either {@link RuntimeException} or {@link Error} are
>>> + * regarded as checked exceptions.
>>>
>>> For consistency you could use the same wording for Exception as you do for Throwable.
>> Hi David.
>>
>> That difference you spotted was intentional in this case. The "subclasses" wording is closer to the wording in JLSv3 section 11, but I thought "subclass" was clearer to state the "RuntimeException or Error" constraint
>>
>> Thanks for the review,
>>
>> -Joe
>
More information about the core-libs-dev
mailing list