<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 20/06/2024 17:43, Archie Cobbs
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CANSoFxuNGojOZfjJWpO8OZJs09fYE9LssbFhveY2j4fURDTv5A@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">On Thu, Jun 20, 2024 at 10:16 AM Maurizio
Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">maurizio.cimadamore@oracle.com</a>>
wrote: <br>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div>
<p style="margin:0px 0px 1.2em">The crucial observation
here is that there can be <i>multiple</i> valid
enclosing instances, and the innermost one might not
be available due to early construction context, so we
need to be able to skip that, and jump to the next</p>
</div>
</div>
</blockquote>
<div>Hah, that's a new one for me... :)</div>
<div><br>
</div>
<div>Just curious, your comment "the JLS text for member inner
class creation seems lacking" makes me wonder if this
obscure corner already existed (i.e., before "flexible
constructors") with the anonymous class equivalent:</div>
<div>
<pre style="font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);display:block;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248)">class Outer2 {
Outer2() {
}
Outer2(Object obj) {
}
class InnerSuperclass {
{ System.out.println(Outer2.this); }
}
static class InnerOuter extends Outer2 {
class InnerInnerOuter extends Outer2 {
InnerInnerOuter() {
super(new InnerSuperclass() { });
}
}
}
public static void main(String[] args) {
new InnerOuter().new InnerInnerOuter(); // prints "Outer2$InnerOuter@327471b5"
}
}
</code></pre>
</div>
<div>That program doesn't compile now but by the same argument
maybe it should - or at least the same ambiguity already
exists?<br>
</div>
</div>
</div>
</blockquote>
The issues are pre-existing, although, w/o JEP 482, the anon
InnerSuperClass would be created in a static context, so it kind of
follows that there's no enclosing instance available there.<br>
<blockquote type="cite" cite="mid:CANSoFxuNGojOZfjJWpO8OZJs09fYE9LssbFhveY2j4fURDTv5A@mail.gmail.com">
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div>
<p style="margin:0px 0px 1.2em">I think that this fix,
coupled with the translation fixes I shared last week
should implement JEP 482 “as intended”</p>
</div>
</div>
</blockquote>
<div>Awesome, thanks for tackling this! Fyi, I've merged this
patch into my <a href="https://urldefense.com/v3/__https://github.com/openjdk/jdk/compare/master...archiecobbs:jdk:javac-pre-capture-fixes?expand=1__;!!ACWV5N9M2RV99hQ!LNS_Z7ARnFzONoErnZklxoEZgNNqB6Z94YH73CC6lr9bNGs2ity2KjdM20yZjTgLM7aJTjO6MNMN0sLbdJaN4ojJJcfNUQ$" moz-do-not-send="true">javac-pre-capture-fixes</a> branch
(already includes your lambda refactoring).</div>
</div>
</div>
</blockquote>
<p>Let me know if that fixes all the issue we're seeing (it would be
great if we could collect all test cases in some github repo, so
that we can add to them easily).</p>
<p>Maurizio<br>
</p>
<blockquote type="cite" cite="mid:CANSoFxuNGojOZfjJWpO8OZJs09fYE9LssbFhveY2j4fURDTv5A@mail.gmail.com">
<div dir="ltr">
<div class="gmail_quote"><br>
</div>
<div class="gmail_quote">-Archie</div>
<div class="gmail_quote"><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">Archie L. Cobbs<br>
</div>
</div>
</blockquote>
</body>
</html>