Vararg records and canonical constructor

Brian Goetz brian.goetz at oracle.com
Sun Dec 29 17:00:53 UTC 2019



On 12/23/2019 11:08 AM, Tagir Valeev wrote:
> Hello!
>
> Two samples:
>
> record Test(int[] args) {
>    public Test(int... args) {
>      this.args = args;
>    }
> }

I agree this would probably be more logical to reject (especially in 
consideration of the other issue you raised, about name mismatches.)  
The signature for the canonical constructor, if provided explicitly, 
should match the record descriptor.  (However, this does not extend to 
annotations, for reasons already discussed in the EG.)


> and
>
> record Test(int... args) {
>    public Test(int[] args) {
>      this.args = args;
>    }
> }

Yes, same argument.




More information about the amber-spec-experts mailing list