Updated Draft specs for JEP 359 (Records)
maurizio.cimadamore at oracle.com
Thu Oct 31 14:29:57 UTC 2019
Related to the earlier discussion on forbidden record members - how is
this section still relevant?
"It is a compile-time error for a record declaration to declare a record
component with the name |clone|, |finalize|, |getClass|, |hashCode|,
|notify|, |notifyAll|, |readObjectNoData|, |readResolve|,
|serialPersistentFields|, |serialVersionUID|, |toString|, |wait|, or
Chris says that the serialization spec ignores all the
serialization-related methods if they appear inside a record; should we
lift the restrictions?
In the grammar for records, I find it odd that we basically say that
record members are class members plus compact constructor, but then we
revert to say that instance initializer are not allowed.
I wonder if a more specific production for the record body would be
useful and more direct here?
I note an asymmetry between the rules for canonical constructor and
compact constructor; in one we say:
"Every field corresponding to a record component of R must be definitely
assigned and moreover not definitely unassigned (16.9) at the end of the
body of the canonical constructor."
In the other we say:
"It is a compile-time error if at the end of the body of the compact
constructor, any of the fields corresponding to the record components of
R are neither definitely assigned nor definitely unassigned."
Moreover, a deeper question: should we leave the magic
auto-initialization of fields only for the compact form? That way, you
would have a _new_ linguistic form, with _new_ properties, whereas old
forms (e.g. a constructor with parameters) will have same rules as
before (can have returns, must initialize fields explicitly). I think
that, from a pedagogical aspect, that would be preferrable.
On 31/10/2019 14:17, Gavin Bierman wrote:
> An updated draft language spec for JEP 359 (Records) is available at:
> (Alongside is a draft JVM spec for this feature:
> As always, please email me any comments/thoughts/bugs.
>> On 23 Aug 2019, at 22:25, Gavin Bierman <gavin.bierman at oracle.com
>> <mailto:gavin.bierman at oracle.com>> wrote:
>> A draft language spec for records is available at:
>> This spec doesn’t yet discuss varargs records - to appear in the next
>> All comments welcomed!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the amber-spec-experts