On Mon, 22 Sep 2025 13:26:30 GMT, Jaikiran Pai <[email protected]> wrote:
> Can I please get a review of this change to a test library class which > proposes to remove the calls to `MessageDigest` from the static initializer > of `jdk.test.lib.Utils`? > > The `Utils` test library class constructs a random generator which can be > used in tests. Back in JDK 16, we updated this class to use a consistent seed > (if none is explicitly set) when running against promotable JDK builds. This > was done in https://bugs.openjdk.org/browse/JDK-8253750. The motivation > behind using a consistent seed as explained in that issue is reasonable. > > In the implementation of seed generation, we generate the seed based off the > JDK build version and we currently use the `java.security.MessageDigest` > class to generate the bytes for the seed. The use of `MessageDigest` here > drags in a lot of security-libs infrastructure. If this `Utils` class then > gets used in tests that configure the security-libs in a specific manner > (like intentionally setting certain configurations which trigger an > exception), then the `Utils` class fails during its static initialization. > This prevents its usage in such tests as well as sometimes causes unexpected > failures like: > > https://bugs.openjdk.org/browse/JDK-8367583 > https://bugs.openjdk.org/browse/JDK-8345578 > > The change in this PR replaces the usage of security-libs infrastructure with > a much more simpler implementation for the seed generation. The proposed > usage of `CRC32`, to generate the seed based off the version, doesn't drag in > these additional classes and should thus prevent issues like the ones noted > above. > > I've run this change locally as well as our CI (tier1, tier2, tier3) and > haven't seen any failures. This pull request has now been integrated. Changeset: 29908148 Author: Jaikiran Pai <[email protected]> URL: https://git.openjdk.org/jdk/commit/29908148f819281dc6d1ef1274ca4d67a47754c0 Stats: 14 lines in 1 file changed: 1 ins; 8 del; 5 mod 8367598: Switch to CRC32C for SEED calculation in jdk.test.lib.Utils Reviewed-by: weijun ------------- PR: https://git.openjdk.org/jdk/pull/27427
