RFR: 8362237: IllegalArgumentException in the launcher when exception without stack trace is thrown

Christian Stein cstein at openjdk.org
Tue Jul 15 12:48:43 UTC 2025


On Tue, 15 Jul 2025 12:20:43 GMT, Christian Stein <cstein at openjdk.org> wrote:

> Please review this change introducing a range check before pruning
> stacktrace elements in source launch mode. An additional `null`-check
> was also added to this change set.

I wonder when and why the exception-handling code moved from `InvocationTargetException::getTargetException` to `InvocationTargetException::getCause`? 🤔

Ah, API documentation of [InvocationTargetException](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/reflect/InvocationTargetException.html#getTargetException()) to the rescue:

> API Note:
This method predates the general-purpose exception chaining facility. The [Throwable.getCause()](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Throwable.html#getCause()) method is now the preferred means of obtaining this information.

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

PR Comment: https://git.openjdk.org/jdk/pull/26315#issuecomment-3073464713


More information about the compiler-dev mailing list