[records] New draft spec for JEP 359

Vicente Romero vicente.romero at oracle.com
Fri Jan 10 19:29:38 UTC 2020



On 1/10/20 1:07 PM, Brian Goetz wrote:
>
>
> 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

let's not forget that we will have a different syntax in the accessor 
`[]` so we could make the syntax the same for the canonical constructor 
but then we will leak at the accessor

Vicente
>
> (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/c4683b31/attachment.htm>


More information about the amber-spec-experts mailing list