RFR: 8366264: tools/javac/launcher/SourceLauncherStackTraceTest.java does not cover the scenario for 8362237

Jan Lahoda jlahoda at openjdk.org
Fri Aug 29 18:26:40 UTC 2025


On Thu, 28 Aug 2025 17:34:31 GMT, Chen Liang <liach at openjdk.org> wrote:

> In #26601, I moved a test case to create a traceless exception for the source launcher that depended on C2 behaviors to a separate test with compiler flags. However, that move is incorrect: to reproduce the issue, the cause exception must have no trace while the InvocationTargetException does. My migrated test blindly turned off stack traces for all exceptions, which is not the intended scenario.
> 
> I found that in Java 7, Throwable, Exception, Error, and RuntimeException get new constructors that allow specifying suppression and trace filling behaviors. We can use that constructor to prohibit stack traces for the cause while preserving the trace for the InvocationTargetException.
> 
> Testing: Running the single source file on Java 24 and getting the array copy IAE (ensure it is a valid reproducer), and running the test to ensure the new case passes.

Looks sensible to me. Please be sure to run tests before integrating.

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

Marked as reviewed by jlahoda (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26993#pullrequestreview-3169666463


More information about the compiler-dev mailing list