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

Pavel Rappo prappo at openjdk.java.net
Thu Oct 21 11:21:05 UTC 2021


On Thu, 21 Oct 2021 09:30:34 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

> This is a conceptually simple change to merge the "Exception" and "Error" classes into a single "Exception Class" group.
> 
> The only change that is not strictly related to the merge is the removal of unused type subsets and related methods in `TypeElementCatalog.java` and the use of `Collections.emptySortedSet()` as the default return value in the `allClasses` method (I made sure it is never modified).

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SummaryListWriter.java line 66:

> 64:             case ENUM -> "doclet.Enums";
> 65:             case EXCEPTION_CLASS -> "doclet.ExceptionClasses";
> 66:             case ANNOTATION_TYPE -> "doclet.Annotation_Types";

(Possibly unrelated to this PR.) This kind of inconsistency in naming is surprising. Even more surprising is the fact that these two resources live in different files. While `ExceptionClasses` lives in doclet.properties, `Annotation_Types` lives in standard.properties. To confuse things even further, `AnnotationType` and `ExceptionClass` live in the same file, doclet.properties.

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");
    }

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

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


More information about the javadoc-dev mailing list