<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">On Jan 13, 2020, at 4:23 PM, Kevin Bourrillion <<a href="mailto:kevinb@google.com" class="">kevinb@google.com</a>> wrote:<br class=""><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class="">On Thu, Jan 9, 2020 at 8:46 PM John Rose <<a href="mailto:john.r.rose@oracle.com" target="_blank" class="">john.r.rose@oracle.com</a>> wrote:<br class=""></div><div dir="ltr" class=""><br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">All we need to do is promise<br class="">
that a record type’s hashCode fulfills the Object contract, especially<br class="">
relative to the record’s equals method.</blockquote><div class=""><br class=""></div><div class="">Yes! This, exactly. Thank you.</div></div></div></div></blockquote><div><br class=""></div>You are welcome!</div><div><br class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_quote"><div class="">(It doesn't even matter if the words in the spec technically admit the possibility it's implemented as `return 0`, because that's just a bad implementation, and specs shouldn't have the burden of saying "by the way this isn't/shouldn't be a bad implementation”.)</div></div></div></blockquote><div><br class=""></div>This is a good thing to remember when writing javadoc.  It gives us</div><div>permission to write less, or push information down into the â€œnotes”.</div><div><div dir="ltr" class=""><div class="gmail_quote"><div class=""><br class=""></div></div></div><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_quote"><div class="">As for toString() it doesn't have the same "Object already says it all" situation, but I would question whether all the guarantees I currently see in the patch are really necessary. How do users benefit from those guarantees?  I do like the "equal values -> equal strings" one (perhaps noting that the inverse doesn't quite hold?).</div></div></div></blockquote><br class=""></div><div>OK, I updated the toString bit to say less following your suggestion:</div><div><br class=""></div><div><pre style="background-color: rgb(238, 238, 238);" class=""><span class="new" style="color: blue;">+     * The precise format produced by this implicitly provided implementation</span>
<span class="new" style="color: blue;">+     * is unspecified and is subject to change.</span>
<span class="new" style="color: blue;">+     * It will, however, always be the case that equal records will</span>
<span class="new" style="color: blue;">+     * report equal strings, under the reasonable assumption that the</span>
<span class="new" style="color: blue;">+     * corresponding property holds for the component types.</span>
</pre><div class=""><span class="new" style="color: blue;"><br class=""></span></div></div><div class="">How and if the component names and values appear is left unstated,</div><div class="">as a matter of QoI.</div><div class=""><br class=""></div><div class="">In some cases, a better QoI might lead to *less* string output, as when</div><div class="">a record has a rarely set optional value, and there’s little value to including</div><div class="">“, optval=Optional.empty” in most of the strings.</div><div class=""><br class=""></div><div class="">In some cases, a better QoI might lead to *more* string output, as when</div><div class="">a record has an array field and (somehow) it is determined that the displayed</div><div class="">value should use Arrays.toString instead of Object.toString.</div><div class=""><br class=""></div><div class="">Dunno how to turn on and off such tweaks, but maybe we figure that out</div><div class="">later, and in that case fewer promises about Record::toString makes for</div><div class="">more choices in the future.</div><div class=""><br class=""></div><div class="">— John</div></body></html>