RFR: JDK-8269401: Merge "Exceptions" and "Errors" into "Exception Classes" [v2]

Jonathan Gibbons jjg at openjdk.java.net
Tue Oct 26 00:16:14 UTC 2021


On Thu, 21 Oct 2021 11:38:12 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java line 518:
>> 
>>> 516:         }
>>> 517:         return typeUtils.isSubtype(te.asType(), getExceptionType())
>>> 518:             || typeUtils.isSubtype(te.asType(), getErrorType());
>> 
>> Would it be clearer if we changed that to this?
>> 
>>     return typeUtils.isSubtype(te.asType(), getThrowableType();
>> 
>> Where `getThrowableType()` is defined as:
>> 
>>     public TypeMirror getThrowableType() {
>>         return getSymbol("java.lang.Throwable");
>>     }
>
> You are right, Throwable is supposed to be included in exception classes. I just re-read the JLS quote from Alex in the JBS issue. I was fooled by the fact that Throwable is currently listed as an ordinary class in javadoc. 
> 
> I will update this PR soon.

That `Throwable` is listed as an ordinary class is an indicator of just how old this policy/code is!

That being said, I hope no developer in their right mind writes `throw new Throwable(...)`!

-------------

PR: https://git.openjdk.java.net/jdk/pull/6061


More information about the javadoc-dev mailing list