[records] updates for Preview 9. hashCode
John Rose
john.r.rose at oracle.com
Tue Jan 14 22:49:54 UTC 2020
On Jan 14, 2020, at 6:49 AM, Daniel Heidinga <Daniel_Heidinga at ca.ibm.com> wrote:
>
> This gets a +1 from me. The format is clear - explained so it's easy
> to understand what the parts mean - and explicit that it may change.
>
> We can't ever stop users from parsing #toString but this is explicit
> that's a bad idea for them to do so.
OK, so I’ve updated the proposed doc change along those lines.
http://cr.openjdk.java.net/~jrose/draft/record-contract
(Previous versions are …/record-contract.{00,01}.)
I adapted the javadoc from AbstractMap::toString, and
then added some sample code, just for grins. It would be
fine to delete the sample code.
* @implNote
* The implicitly provided implementation returns a string which begins
* with the unqualified name of the record class and is immediately
* followed by a list of components, in declaration order,
* enclosed in square brackets ({@code "[]"}). Adjacent components
* are separated by the characters {@code ", "} (comma and space).
* Each component is rendered as the name followed by an equals sign
* ({@code "="}) followed by a string representing the associated value.
The language is intentionally vague about what is “a string representing
the associated value”. There are comments in the prototype that mention
maybe adding quotes to some values (Strings). So I left that open.
— John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20200114/f96bcf3d/attachment.htm>
More information about the amber-spec-experts
mailing list