<div dir="ltr"><div>I feel like Remi has a good point somewhere in here, though I'm not sure I can articulate it any better than he does....</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Jan 21, 2026 at 12:02 PM Brian Goetz <<a href="mailto:brian.goetz@oracle.com">brian.goetz@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  
  <div>So there are two stabled, principled alternatives:<br>
    <br>
     - Just don't ever try to derive equals and hashCode <br>
     - Derive equals and hashCode similarly as for records<br>
    <br>
    And of course, the first means that records cannot be considered
    special cases of carriers.  So the latter seems a forced move.  <br></div></blockquote><div><br></div><div>Hmm... why not? Can we not say: "A record is a special case of a carrier that ... and also auto-generates equals() and hashCode()" ?</div><div><br></div><div>[ There is some implied heresy here, which is that maybe it was wrong for records to auto-generate equals/hashCode in the first place. I found it a bit surprising the first time I tried to put some <span style="font-family:monospace">public record GraphNode</span> objects into a <span style="font-family:monospace">Set</span> and inadvertently created a bunch of infinite loops which I had to fix by overriding <span style="font-family:monospace">equals()</span> with <span style="font-family:monospace">==</span> and <span style="font-family:monospace">hashCode()</span> with <span style="font-family:monospace">System.identityHashCode()</span>. But obviously that horse is out of the barn... ]</div><div><br></div><div>In other words, I like Remi's conceptual idea of carrier classes being "(possibly abstract) things with virtual components". Really that's almost like saying "modernized java beans". Then a record could still be a specialized, locked down, concrete form of a carrier class.</div><div><br></div><div>-Archie</div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>