[records] updates for Preview 9. hashCode
John Rose
john.r.rose at oracle.com
Mon Jan 13 23:44:35 UTC 2020
On Jan 10, 2020, at 1:20 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
>
> No objection to further hashing the specification of the hash. Care to post a proposed patch for the spec in j.l.Record?
Sure:
http://cr.openjdk.java.net/~jrose/draft/record-contract/
This fences out user assumptions about hashCode.
While I was at it I also did equals and toString.
The toString language is an example of applying similar
limitations. Probably it goes into too much detail; I added
it for the sake of discussion.
BTW, when designing the toString methods for MethodHandle
and MethodType we were ruthless about removing package
prefixes, and I’m glad we did it that way. Package prefixes
are noisy in toString output. I’m glad to see it going that
way with Record::toString also.
— John
More information about the amber-spec-experts
mailing list