On Fri, 26 Aug 2022 14:23:04 GMT, Aleksey Shipilev <[email protected]> wrote:
>> Look at implementation and figure out what happens if you do:
>>
>>
>> computeHash("SHA-1") = someHash;
>> computeHash("SHA-256") = ...?
>>
>>
>> The caching method should actually check the algorithms match.
>>
>> Not a bug at this point, since only use SHA-256 today, but this is a
>> landmine ready to fire.
>>
>> Additional testing:
>> - [x] Linux x86_64 release, `java/lang/module` tests
>
> Aleksey Shipilev has updated the pull request incrementally with one
> additional commit since the last revision:
>
> Review comments
src/java.base/share/classes/jdk/internal/module/ModuleReferenceImpl.java line
69:
> 67: // wrap the fields updated at the same time with a record, which
> carries
> 68: // the implicit final-field semantics for its members.
> 69: private record CachedHash(byte[] hash, String algorithm) {}
The comment still seems a bit excessive, maybe drop the last bit "which carries
..." as it is not needed here.
-------------
PR: https://git.openjdk.org/jdk/pull/10044