RFR: JDK-8280168: Add Objects.toIdentityString [v6]

Joe Darcy darcy at openjdk.java.net
Mon Jan 24 21:31:41 UTC 2022


On Mon, 24 Jan 2022 19:19:21 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Joe Darcy has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
>> 
>>  - Merge branch 'master' into JDK-8280168
>>  - Appease jcheck.
>>  - Add toIdentityString
>>  - Respond to review feedback to augment test.
>>  - Respond to review feedback.
>>  - JDK-8280168 Add Objects.toDefaultString
>
> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line 295:
> 
>> 293:         assert(isObjectMethod(m)) : m;
>> 294:         return switch (m.getName()) {
>> 295:             case "toString" -> java.util.Objects.toDefaultString(self);
> 
> It might be better if toString is changed to invoke toIdentityString(self), only because hashCode returns the identity hash code, it doesn't invoke hashCode().

Yes; that looks like an inconsistency/bug. Updated in a subsequent push.

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

PR: https://git.openjdk.java.net/jdk/pull/7139


More information about the core-libs-dev mailing list