Varargs records

Kevin Bourrillion kevinb at google.com
Thu Aug 15 18:37:15 UTC 2019


I believe anyone would expect this to work as described, certainly.


On Thu, Aug 15, 2019 at 11:35 AM Brian Goetz <brian.goetz at oracle.com> wrote:

> As I was writing some tests for records, it occurs to me that we never
> explicitly discussed whether we should support _varargs_ records, such as:
>
>      record StringBunch(String... strings) { }
>
> The translation would be straightforward:
>   - The type of the strings field is String[]
>   - The return type of the strings accessor is String[]
>   - The canonical constructor is of descriptor (String...) rather than
> (String[]), allowing varargs invocation of the constructor.
>   - There would be the usual restriction that there can be only one
> varargs argument, and it must be last.
>
> So this seems feasible.  Is this something we want?
>


-- 
Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at google.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190815/5bfa5ecc/attachment.html>


More information about the amber-spec-experts mailing list