RFR: 8358633 : Test ThreadPoolExecutorTest::testTimedInvokeAnyNullTimeUnit is broken by JDK-8347491

Viktor Klang vklang at openjdk.org
Thu Jun 5 09:09:50 UTC 2025


On Thu, 5 Jun 2025 08:12:29 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> It's too fragile to depend on generated NPE messages
>
> Sorry Viktor but I strongly disagree. It is far too easy to have a test "pass" because it catches the wrong instance of a thrown exception and hide an underlying problem.

@dholmes-ora In general I agree with you 100%, in this case it was actually the addition of the exception message which broke test runs when -XX:-OmitStackTraceInFastThrow disables JEP 358: https://github.com/openjdk/jdk/commit/f141674d1619d95053d38a9cd8f93a8959b4a211#diff-17cb67c2df590a137a7c215e9367919cd7224b4eedd9c1b0a7e35ccd0a1ac450R1730

So yeah, we could change the test to accept either a null message, or the JEP 358 message, but a null message would still be not verifying that it is thrown for the intended reason (thus hiding underlying issues, as you noted).

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

PR Comment: https://git.openjdk.org/jdk/pull/25655#issuecomment-2943361363


More information about the core-libs-dev mailing list