Draft specification for java.lang.Record

Brian Goetz brian.goetz at oracle.com
Sat Aug 17 14:11:45 UTC 2019


> Hi all,
> why Record is a class (an abstract class) and not an interface ?

It's a fair question.  At this point, it could go either way, and both 
have pros and cons.

> Being an interface also means that we will be able to mix an inline 
> type and a record, an inline record?, for free, and more generally

We are not ignoring this issue!  But I am not sure that "for free" is 
quite right.  It's a high priority to work out the abstract class / 
interface story for inline classes, and while j.l.Record is a tiny piece 
of that, there's way more to it.  So my preference is to figure out 
where we want to be on that story, and then adjust Record if need be.

> Record being an interface is less disruptive than being a class when 
> you want to retrofit a class to be a record.

I don't see this; if the class already has a superclass, you need to fix 
that before it becomes a record anyway.

Another issue to be worked out is what are the degrees of freedom should 
we want to support abstract records in the future.  Also on the list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190817/a73f0c01/attachment.html>


More information about the amber-spec-experts mailing list