Withdrawn: 8335478: Add notes for Error handling in Method.invoke and Constructor.newInstance

duke duke at openjdk.org
Tue Aug 27 03:31:12 UTC 2024


On Mon, 1 Jul 2024 21:48:44 GMT, Chen Liang <liach at openjdk.org> wrote:

> `Method.invoke` and `Constructor.newInstance` wraps `Error` in `InvocationTargetException`, which is bug-prone for users. Worse, this is only ambiguously mentioned in the API specification.
> 
> This patch proposes to explicitly mention that `InvocationTargetException` wraps any throwable, and adds an API notes section describing the risk of not handling `InvocationTargetException` (and thereby ignoring the wrapped errors), to advise against future user errors.

This pull request has been closed without being integrated.

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

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


More information about the core-libs-dev mailing list