Updated Draft specs for JEP 359 (Records)

Alex Buckley alex.buckley at oracle.com
Wed Nov 6 18:21:50 UTC 2019


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.)

As an aside, please drop "We're being intentionally vague here about 
just what it means for a class to have a "component"." 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.]

Alex


More information about the amber-spec-experts mailing list