Inline Record

John Rose john.r.rose at oracle.com
Wed May 6 23:11:35 UTC 2020


On May 6, 2020, at 3:42 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> 
> Eventually, inline classes will inherit eq/hashCode from Object.

Crazy half-baked idea of the moment:

Factor the equals/hashCode/toString methods for records into
static methods (in ju.Objects) which are configurable appropriately,
and have a default configuration.  Use ClassValue for performance.

Then define equals/hashCode/toString in jl.Object (yes, Object)
to call those methods, *when the receiver is a Record and/or an inline*.

Two ideas here:  1. No per-class indy or BSM at all, but a ClassValue
instead.  (We should do this for Record anyway.)  2. Push the specification
all the way up to Object.  (2 makes more sense for inlines than for
Record, since it’s natural to define equals/hashCode/toString in
the class hierarchy, if there’s a place to put it.  There isn’t for inlines.)

— John


More information about the amber-dev mailing list