Updated Draft specs for JEP 359 (Records)
Alex Buckley
alex.buckley at oracle.com
Mon Nov 4 21:54:16 UTC 2019
On 11/4/2019 12:50 PM, Florian Weimer wrote:
> I think we are looking at different versions of the spec. I don't see
> either wording here:
>
> <http://cr.openjdk.java.net/~gbierman/jep359/jep359-20191031/specs/records-jls.html#jls-8.10.4>
>
> But the updated wording works for me.
Doh, you're right, and the updated spec already reflects some of the
re-structuring I talked about in mail. However, the thrust of my
comments about detaching 'public' and 'throws' from the definition of
"canonical" still apply. The 2019-10-31 spec says "If the canonical
constructor is not explicitly declared, then it is implicitly declared."
but it is not possible to implicitly declare `public R(int i)` if the
pretender `R(int i)` has been explicitly declared in `record R(int i)`.
Yes, there is an error mandated for the pretender -- "The erasure of the
signature of the constructor must not be equal to the erasure of the
signature of the canonical constructor." -- but (1) A compiler vendor
now has an impossible thing mandated on the one hand and a
must-not-be-equal error mandated on the other hand, so which should be
reported first? and (2) While it's appropriate to mention erasure when
contrasting List<String> and List (e.g. the javac test case), it's
confusing to mention erasure when dealing with int and int. The JLS
should be more explicit about how mis-declared modifiers and 'throws'
are handled.
Alex
More information about the amber-dev
mailing list