Draft Spec for Second Preview of Flexible Constructor Bodies (JEP 482)
Stephan Herrmann
stephan.herrmann at berlin.de
Sun Jul 14 19:49:46 UTC 2024
This part doesn't look fully resolved to me:
Am 28.05.24 um 19:20 schrieb Stephan Herrmann:
> [...] > In §8.8.7.1 it says:
> "References to instance variables of class C are disallowed ..."
> which seems to disqualify the following code:
>
> public class C {
> String name;
> C(C other) {
> System.out.println(other.name);
> super();
> }
> }
>
> I assume this paragraph in italics is not normative, right? Later paragraphs are
> clear that this applies to single name references and this references, but still
> the above sentence seems misleading. The same applies for the next two sentences
> (regarding other.foo(), or new other.Inner()).
> [...]
While the detailed rules in 15.12.3 look good, the explanation in 8.8.7.1 still
lacks precision. If that explanation is not meant to be precise, maybe it should
indicate this :)
The same problem also exists in the summary in 6.5.7.1 (which is not italics -
explanatory):
"The rules (15.12.3) also prohibit a reference to an instance method occurring
in any one of the following:
...
3. an early construction context (8.8.7.1) of a class where the instance method
is a member."
Interestingly, 6.5.7.1 is more precise regarding qualified this expressions than
what §15.8.4 says about it (see my previous post).
thanks,
Stephan
More information about the amber-spec-experts
mailing list