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

Chen Liang liach at openjdk.org
Thu Aug 28 17:39:53 UTC 2025


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 AIOOBE (ensure it is a valid reproducer), and running the test to ensure the new case passes.

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

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

Changes: https://git.openjdk.org/jdk/pull/26993/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26993&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8366264
  Stats: 108 lines in 2 files changed: 24 ins; 84 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/26993.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26993/head:pull/26993

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


More information about the compiler-dev mailing list