Updated Draft specs for JEP 359 (Records)

Dan Smith daniel.smith at oracle.com
Mon Nov 25 20:42:25 UTC 2019

> On Nov 6, 2019, at 11:21 AM, Alex Buckley <alex.buckley at oracle.com> wrote:
> On 10/31/2019 7:17 AM, Gavin Bierman wrote:
>> (Alongside is a draft JVM spec for this feature:
>> http://cr.openjdk.java.net/~gbierman/jep359/jep359-20191031/specs/records-jvms.html
>> )
> I looked at this for the CSR JDK-8233595. The `component_info` structure which is mentioned all over the place really tripped me up. Unlike fields and methods, a component isn't a first-class JVM construct, so a simple (i.e. unqualified) name is not deserved. Even the JLS always uses the qualified name, "record component" (if nothing else, to distinguish from "array component").
> It would be wrong to replace mentions of the `component_info` structure with mentions of the `Record_attribute` structure, because `Record_attribute` isn't literally the structure which holds attributes (whereas the oft-mentioned `Code_attribute` structure really is). It would also be clunky to spell out "the `component_info` structure of the `Record_attribute` structure" in many places.
> For spec clarity, please rename `component_info` to `record_component_info`. (From a search of internal mail, I believe `component_info` was introduced around 7/24 in a discussion about annotations on record components, as an alternative to reusing the `field_info` structure in Record. Now that the term has spread throughout JVMS ch.4, it's time to name it properly.)

I hadn't seen this comment, but I've now applied this change as requested (will show up next time Gavin posts an update).

> As an aside, please drop "We're being intentionally vague here about just what it means for a class to have a "component"."

Yep, that was intended for earlier in the design, no longer relevant. Done.

> and strengthen the opener: "The Record attribute is a variable-length attribute in the attributes table of a ClassFile structure. ***A `Record` attribute indicates that this class is a _record type_ (JLS §8.10), declared with a list of _record components_.***"  [Almost certainly declared _in source code_, but maybe this class file was auto-generated, so no need to say how the record type was declared ... but it was, since here we are in its class file.]

This came up in the CSR, and the conclusion was to *weaken* it—JVMS doesn't care about record types and under what conditions a class is or isn't considered a record. This sentence is purely meant to give readers some idea about why this attribute exists. So I've revised it to:

"The `Record` attribute records information about the components of a record
type (JLS 8.10)."

More information about the amber-spec-experts mailing list