Re: RFR: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes

2024-10-23 Thread Rémi Forax
On Wed, 23 Oct 2024 15:36:08 GMT, Joe Darcy wrote: >> src/java.base/share/classes/java/lang/Boolean.java line 259: >> >>> 257: public boolean equals(Object obj) { >>> 258: if (obj instanceof Boolean b) { >>> 259: return value == b.booleanValue(); >> >> I would go even a

Re: RFR: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes

2024-10-23 Thread Joe Darcy
On Wed, 23 Oct 2024 16:10:01 GMT, Chen Liang wrote: >> In other place in the code, I've written out "ell" to avoid any confusion >> between lowercase "l" and a number "1", etc. > > What does "ell" stand for? Looks like "eel" to me. > That aside, if there's no good name, we usually use `that` or

Re: RFR: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes

2024-10-23 Thread Joe Darcy
On Wed, 23 Oct 2024 16:02:07 GMT, Roger Riggs wrote: > lgtm Thanks @RogerRiggs. I'm going to push this PR as-is; any further refinements can be done next time someone is updating these classes. - PR Comment: https://git.openjdk.org/jdk/pull/21652#issuecomment-2433088864

Re: RFR: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes

2024-10-23 Thread Chen Liang
On Wed, 23 Oct 2024 15:37:00 GMT, Joe Darcy wrote: >> src/java.base/share/classes/java/lang/Long.java line 1249: >> >>> 1247: public boolean equals(Object obj) { >>> 1248: if (obj instanceof Long ell) { >>> 1249: return value == ell.longValue(); >> >> Suggestion: >> >>

Re: RFR: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes

2024-10-23 Thread Roger Riggs
On Wed, 23 Oct 2024 02:06:20 GMT, Joe Darcy wrote: > Noticed this refactoring opportunity while doing some other work in the area. lgtm - Marked as reviewed by rriggs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/21652#pullrequestreview-2389308583

Re: RFR: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes

2024-10-23 Thread Joe Darcy
On Wed, 23 Oct 2024 02:14:49 GMT, Chen Liang wrote: >> Noticed this refactoring opportunity while doing some other work in the area. > > src/java.base/share/classes/java/lang/Long.java line 1249: > >> 1247: public boolean equals(Object obj) { >> 1248: if (obj instanceof Long ell) { >

Re: RFR: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes

2024-10-23 Thread Joe Darcy
On Wed, 23 Oct 2024 05:45:33 GMT, Rémi Forax wrote: >> Noticed this refactoring opportunity while doing some other work in the area. > > src/java.base/share/classes/java/lang/Boolean.java line 259: > >> 257: public boolean equals(Object obj) { >> 258: if (obj instanceof Boolean b) {

Re: RFR: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes

2024-10-22 Thread Rémi Forax
On Wed, 23 Oct 2024 02:06:20 GMT, Joe Darcy wrote: > Noticed this refactoring opportunity while doing some other work in the area. src/java.base/share/classes/java/lang/Boolean.java line 259: > 257: public boolean equals(Object obj) { > 258: if (obj instanceof Boolean b) { > 259:

Re: RFR: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes

2024-10-22 Thread Chen Liang
On Wed, 23 Oct 2024 02:06:20 GMT, Joe Darcy wrote: > Noticed this refactoring opportunity while doing some other work in the area. src/java.base/share/classes/java/lang/Long.java line 1249: > 1247: public boolean equals(Object obj) { > 1248: if (obj instanceof Long ell) { > 1249:

RFR: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes

2024-10-22 Thread Joe Darcy
Noticed this refactoring opportunity while doing some other work in the area. - Commit messages: - JDK-8342863: Use pattern matching for instanceof in equals methods of wrapper classes Changes: https://git.openjdk.org/jdk/pull/21652/files Webrev: https://webrevs.openjdk.org/?repo