<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<br id="lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On 14 Jul 2024, at 21:14, Archie Cobbs <archie.cobbs@gmail.com> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div dir="ltr">
<div>I think you are correct in that the spec needs further clarification on those two points.</div>
<div><br>
</div>
<div>I can at least confirm that what the compiler currently implements is in fact the intended behavior:</div>
<div>
<ul>
<li>Access to superclass instance fields by any means in an early construction context is not allowed</li><li>The rules for "foo", "this.foo", and "C.this.foo" (for the same "foo") in an early construction context should be the same<br>
</li></ul>
<div>-Archie<br>
</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Thanks Stephan. We had already spotted the inconsistency between this.foo and C.this.foo and filed a spec bug: <a href="https://bugs.openjdk.org/browse/JDK-8334163">https://bugs.openjdk.org/browse/JDK-8334163</a></div>
<div><br>
</div>
<div>I believe that there are other areas in the spec where they are not treated the same, so I had planned to do a more complete sweep through the spec to consider a more complete fix.</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Gavin</div>
<br>
<blockquote type="cite">
<div>
<div dir="ltr"><br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Jul 14, 2024 at 2:50 PM Stephan Herrmann <<a href="mailto:stephan.herrmann@berlin.de">stephan.herrmann@berlin.de</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
This part doesn't look fully resolved to me:<br>
<br>
Am 28.05.24 um 19:20 schrieb Stephan Herrmann:<br>
> [...] > In §8.8.7.1 it says:<br>
>      "References to instance variables of class C are disallowed ..."<br>
> which seems to disqualify the following code:<br>
> <br>
> public class C {<br>
>      String name;<br>
>      C(C other) {<br>
>          System.out.println(<a href="http://other.name/" rel="noreferrer" target="_blank">other.name</a>);<br>
>          super();<br>
>      }<br>
> }<br>
> <br>
> I assume this paragraph in italics is not normative, right? Later paragraphs are
<br>
> clear that this applies to single name references and this references, but still
<br>
> the above sentence seems misleading. The same applies for the next two sentences
<br>
> (regarding other.foo(), or new other.Inner()).<br>
> [...]<br>
<br>
<br>
While the detailed rules in 15.12.3 look good, the explanation in 8.8.7.1 still <br>
lacks precision. If that explanation is not meant to be precise, maybe it should <br>
indicate this :)<br>
<br>
The same problem also exists in the summary in 6.5.7.1 (which is not italics - <br>
explanatory):<br>
<br>
"The rules (15.12.3) also prohibit a reference to an instance method occurring <br>
in any one of the following:<br>
...<br>
3. an early construction context (8.8.7.1) of a class where the instance method <br>
is a member."<br>
<br>
<br>
Interestingly, 6.5.7.1 is more precise regarding qualified this expressions than <br>
what §15.8.4 says about it (see my previous post).<br>
<br>
thanks,<br>
Stephan<br>
<br>
</blockquote>
</div>
<br clear="all">
<br>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">Archie L. Cobbs<br>
</div>
</div>
</blockquote>
</div>
<br>
</body>
</html>