On Fri, 28 Oct 2022 23:20:26 GMT, Pavel Rappo <pra...@openjdk.org> wrote:
>> 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. 👍 for the immediately preceding code sample for a simplified `try` ------------- PR: https://git.openjdk.org/jdk/pull/10746