RFR: 8323746: Add PathElement hashCode and equals [v2]

ExE Boss duke at openjdk.org
Sat Feb 3 11:32:02 UTC 2024


On Fri, 2 Feb 2024 07:41:16 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR proposes to implement `hashCode()` and `equals()` methods for implementations of `PathElement`.
>> 
>> In doing so, the previous `PathElementImpl` was removed and replaced in favor of distinct `record` implementations, each reflecting its own path element selection type. This also allowed the `PathKind` to be removed as this piece of information is now carried in the sealed type hierarchy. 
>> 
>> It is worth noting, the implementations resides in the `jdk.internal` package and consequently, they are not exposed to clients. So, we could use pattern matching (for example) internally but not in client code.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Make all PathElements records

These can now be removed:

src/java.base/share/classes/jdk/internal/foreign/LayoutPath.java line 468:

> 466:             return 31;
> 467:         }
> 468: 

Suggestion:

src/java.base/share/classes/jdk/internal/foreign/LayoutPath.java line 494:

> 492:             return 63;
> 493:         }
> 494: 

Suggestion:

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

PR Review: https://git.openjdk.org/jdk/pull/17651#pullrequestreview-1861006117
PR Review Comment: https://git.openjdk.org/jdk/pull/17651#discussion_r1477051207
PR Review Comment: https://git.openjdk.org/jdk/pull/17651#discussion_r1477051227


More information about the core-libs-dev mailing list