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.

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

Commit messages:
 - 8367598: Switch to CRC32C for SEED calculation in jdk.test.lib.Utils

Changes: https://git.openjdk.org/jdk/pull/27427/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27427&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8367598
  Stats: 14 lines in 1 file changed: 1 ins; 8 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/27427.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27427/head:pull/27427

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

Reply via email to