On Thu, 21 Oct 2021 11:38:12 GMT, Hannes Wallnöfer <[email protected]> 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

Reply via email to