[records] New draft spec for JEP 359

Brian Goetz brian.goetz at oracle.com
Fri Jan 10 18:07:44 UTC 2020



On 1/10/2020 11:30 AM, Tagir Valeev wrote:
> I don't see any changes regarding the variable arity mismatch between
> the canonical constructor and record header. See my e-mail [1]. Was
> this suggestion rejected or overlooked?

This can be accomplished by adding

  - If the record is a varargs record, the canonical constructor must be 
a varargs constructor;
  - If the record is not a varargs record, the canonical constructor 
must not be a varargs constructor

(modulo terminology)

to

> If a canonical constructor is explicitly declared, then it must 
> additionally satisfy the following conditions; otherwise a 
> compile-time error occurs:
>
>  *
>
>     The names and types of the formal parameters in the formal
>     parameter list of the canonical constructor must be identical to
>     the names and declared type of the corresponding record component.
>
>  *
>
>     A canonical constructor must not be generic (8.8.4
>     <https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.8.4>).
>
>  *
>
>     A canonical constructor must be declared|public|.
>
>  *
>
>     A canonical constructor must not have a|throws|clause.
>
>  *
>
>     The body of a canonical constructor must not contain an explicit
>     constructor invocation statement (8.8.7.1
>     <https://docs.oracle.com/javase/specs/jls/se13/html/jls-8.html#jls-8.8.7.1>).
>
>  *
>
>     All the other rules for a constructor in a normal class
>     declaration must be satisfied (8.8
>     <http://cr.openjdk.java.net/~gbierman/jep359/jep359-20200110/specs/records-jls.html#jls-8.8>).
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20200110/0eecb6fc/attachment-0001.htm>


More information about the amber-spec-experts mailing list