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

ExE Boss duke at openjdk.org
Thu Jul 17 11:07:55 UTC 2025


On Wed, 16 Jul 2025 17:41:27 GMT, Christian Stein <cstein at openjdk.org> wrote:

>> Please review this change introducing a range check before pruning
>> stacktrace elements in source launch mode. Additional `null`-checks
>> are also added to this change set.
>
> Christian Stein has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add null checks for getStackTrace() results

src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/SourceLauncher.java line 265:

> 263:             // remove stack frames for source launcher
> 264:             StackTraceElement[] invocationElements = exception.getStackTrace();
> 265:             if (invocationElements == null) throw exception;

`invocationElements` can’t be `null`, as the `InvocationTargetException` is thrown by the reflection implementation:
https://github.com/openjdk/jdk/blob/3fd89be6d1a51b6fc99f4c0b5daba7a4bd64a08e/src/java.base/share/classes/jdk/internal/reflect/DirectMethodHandleAccessor.java#L103-L120

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26315#discussion_r2213038398


More information about the compiler-dev mailing list