On Mon, 16 Mar 2026 16:03:34 GMT, Vicente Romero <[email protected]> wrote:
>> this test case is being rejected by javac:
>>
>> class Test {
>> Test(Test t) {}
>>
>> Test(String s) {
>> this(new Test());
>> }
>>
>> Test() {}
>> }
>>
>> here what is happening is that when analyzing the `new Test()` invocation
>> the code to determine if there is an enclosing instance for this expression,
>> javac is not checking first if there is an enclosing instance at all. This
>> analysis shouldn't be done for cases like the one above for which there is
>> no enclosing instance.
>>
>> TIA
>
> Vicente Romero has updated the pull request incrementally with one additional
> commit since the last revision:
>
> another iteration
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1458:
> 1456: if (t.tsym.isInner() &&
> 1457: t.tsym.isEnclosedBy(localEnv.enclClass.sym) &&
> 1458: !t.tsym.isStatic() &&
Is this check now redundant when there is `t.tsym.isInner()`?
-------------
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2231#discussion_r2941758314