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.

Thank you Weijun for the review.

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

PR Comment: https://git.openjdk.org/jdk/pull/27427#issuecomment-3323175286

Reply via email to