[records] Spec for next version of Record Classes JEP
gavin.bierman at oracle.com
Wed Oct 14 21:19:22 UTC 2020
> On 29 Sep 2020, at 22:32, Brian Goetz <brian.goetz at oracle.com> wrote:
> Should @SafeVarargs be allowed to be applied to a varargs record? Should it get propagated to the constructor in that case? Or do we just have people declare a compact constructor with @SafeVarargs? What is the correct use of @SV for varargs records?
Right now, if you annotate a record component with @SafeVarArgs you are in trouble, because @SafeVarArgs is applicable in the method context, and so it will be propagated to the accessor method. As the accessor method is a fixed arity method, that’s going to be an error.
We say currently that you should declare a constructor with @SafeVarArgs. That seems reasonable to me.
Unless someone thinks otherwise, I don’t think we should be special-casing this annotation. (I guess we can always do this in a later release.)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the amber-spec-experts