RFR: 8285488: Improve DocFinder [v4]

Pavel Rappo prappo at openjdk.org
Fri Oct 28 23:22:30 UTC 2022


On Fri, 28 Oct 2022 22:23:13 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> I don't (yet?) see why that language design issue arises here.   It looks like you're doing a multi-catch of a series of 4 subtypes of `Failure`, and an "other".  I don't see where any exception type parameter comes in.
>
> Ah OK, there's one hidden in the signature of the `trySearch` method. Is that one important?

trySearch throws Failure, because it cannot throw a union consisting of these three exceptions using just a single exception type parameter:

* Failure.UnsupportedTypeParameter
* Failure.ExceptionTypeNotFound
* Failure.NotExceptionType

So I make a general "Failure" mixture, from which I'll later refine individual constituents. I think we can do this, but that's it:

        try {
            result = utils.docFinder().trySearch(holder, criterion);
        } catch (Failure.NotExceptionType
                 | Failure.ExceptionTypeNotFound
                 | Failure.UnsupportedTypeParameter x) {
            throw x;
        } catch (Failure f) {
            throw newAssertionError(f);
        }

Maybe my comment was misplaced (the comment is about `Criterion`, not `trySearch`)? I can perhaps remove it altogether if it doesn't bring much value.

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

PR: https://git.openjdk.org/jdk/pull/10746


More information about the javadoc-dev mailing list