Re: RFR: 8311170: Simplify and modernize equals and hashCode in security area [v9]

2023-07-17 Thread Pavel Rappo
On Mon, 17 Jul 2023 18:39:37 GMT, Daniel Jeliński wrote: > I think `oid.hashCode() + Arrays.hashCode(nameValue)` would have been good > enough, but deepHashCode is also acceptable. Fixed as you suggested, in 3139043370f. - PR Review Comment: https://git.openjdk.org/jdk/pull/14738#

Re: RFR: 8311170: Simplify and modernize equals and hashCode in security area [v9]

2023-07-17 Thread Daniel Jeliński
On Mon, 17 Jul 2023 18:13:38 GMT, Pavel Rappo wrote: >> Thanks for noticing this difference! >> >> Yes, the initial value would've been exponentiated (^ or ** in your >> notation). However, I note that the original code computed this: >> >> if nameValue.length > 0 >> >> (37^nameValue.leng

Re: RFR: 8311170: Simplify and modernize equals and hashCode in security area [v9]

2023-07-17 Thread Pavel Rappo
On Mon, 17 Jul 2023 12:23:17 GMT, Pavel Rappo wrote: >> The original code calculated `(37 ** >> nameValue.length)*(37+oid.hashCode)+Arrays.hashCode`; since you already >> dropped the multiplication, you can also drop the addition. > > Thanks for noticing this difference! > > Yes, the initial v

Re: RFR: 8311170: Simplify and modernize equals and hashCode in security area [v9]

2023-07-17 Thread Pavel Rappo
On Mon, 17 Jul 2023 11:02:46 GMT, Daniel Jeliński wrote: >> You think it was a typo (+ instead of *) in the original code? > > The original code calculated `(37 ** > nameValue.length)*(37+oid.hashCode)+Arrays.hashCode`; since you already > dropped the multiplication, you can also drop the addit

Re: RFR: 8311170: Simplify and modernize equals and hashCode in security area [v9]

2023-07-17 Thread Daniel Jeliński
On Mon, 17 Jul 2023 10:59:42 GMT, Pavel Rappo wrote: >> src/java.base/share/classes/sun/security/x509/OtherName.java line 212: >> >>> 210: public int hashCode() { >>> 211: if (myhash == -1) { >>> 212: myhash = 37 + oid.hashCode() + Arrays.hashCode(nameValue); >> >> I thi

Re: RFR: 8311170: Simplify and modernize equals and hashCode in security area [v9]

2023-07-17 Thread Daniel Jeliński
On Thu, 13 Jul 2023 22:57:49 GMT, Pavel Rappo wrote: >> Please review this PR to use modern APIs and language features to simplify >> `equals` and `hashCode` in security area. >> >> I understand that security area is sensitive and a non-expert, such as >> myself, should tread carefully; so bel

Re: RFR: 8311170: Simplify and modernize equals and hashCode in security area [v9]

2023-07-17 Thread Pavel Rappo
On Mon, 17 Jul 2023 10:15:18 GMT, Daniel Jeliński wrote: >> Pavel Rappo has updated the pull request incrementally with five additional >> commits since the last revision: >> >> - Feedback: avoid intermediate assignments >> - More previously missed cases >> - Fix: log hashCode as an unsigned

Re: RFR: 8311170: Simplify and modernize equals and hashCode in security area [v9]

2023-07-14 Thread Roger Riggs
On Thu, 13 Jul 2023 22:57:49 GMT, Pavel Rappo wrote: >> Please review this PR to use modern APIs and language features to simplify >> `equals` and `hashCode` in security area. >> >> I understand that security area is sensitive and a non-expert, such as >> myself, should tread carefully; so bel

Re: RFR: 8311170: Simplify and modernize equals and hashCode in security area [v9]

2023-07-13 Thread Pavel Rappo
> Please review this PR to use modern APIs and language features to simplify > `equals` and `hashCode` in security area. > > I understand that security area is sensitive and a non-expert, such as > myself, should tread carefully; so below are my notes to assist the review. > > * Unlike `hashCod