Draft JLS spec for records

Vicente Romero vicente.romero at oracle.com
Mon Aug 26 14:06:43 UTC 2019



On 8/26/19 10:03 AM, Chris Hegarty wrote:
> Gavin,
>
> On 23/08/2019 22:25, Gavin Bierman wrote:
>> A draft language spec for records is available at:
>>
>> http://cr.openjdk.java.net/~gbierman/8222777/8222777-20190823/specs/records-jls.h 
>>
>
> "8.10.4 Record Constructor Declarations
>
>  Every record type R has a canonical constructor. This is a public
>  constructor whose formal parameter list is identical to the record
>  header of R."
>
> -- 
>
> So for example, is this considered a canonical constructor?
>
>   record R(int i, int j) {
>     public R(int jjj, int iii) {
>       this.i = jjj;
>       this.j = iii;
>     }
>   }
>
> Does "formal parameter list" include the component name ( as well as 
> the order and type )?

yes the canonical constructor has to match on component names too,
>
> -Chris.
Vicente


More information about the amber-spec-experts mailing list