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

Christian Stein cstein at openjdk.org
Fri Aug 29 08:06:42 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.

Marked as reviewed by cstein (Committer).

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

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


More information about the compiler-dev mailing list