On Thu, 3 Aug 2023 21:43:44 GMT, Valerie Peng <valer...@openjdk.org> wrote:

>> Pavel Rappo has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Feedback
>
> src/java.base/share/classes/sun/security/x509/PolicyInformation.java line 140:
> 
>> 138:     @Override
>> 139:     public int hashCode() {
>> 140:         return Objects.hash(policyIdentifier, policyQualifiers);
> 
> What is the criteria for changing the hashCode() impl? It seems that you 
> change some and not others. With the many hashCode() impls (e.g. 
> Objects.hash(), Arrays.hashCode()), I wonder why this and not that.

Whether I suggest changing hashCode or not depends on multiple criteria, of 
which these two are the most important:

  * Is the value specified or relied upon?
  * Does it need to be performant?

If the answer to both of these is "NO", I might refactor hashCode. One 
unintended side effect, is that sometimes such a refactoring improves hashCode 
quality (think: perfect hashing) almost for free.

If you have concerns on particular refactorings, I'd be happy to discuss them.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14738#discussion_r1284535886

Reply via email to