[lworld] RFR: 8371356: [lworld] 'super' should be rejected in early construction context

Chen Liang liach at openjdk.org
Mon Nov 17 19:19:42 UTC 2025


On Mon, 17 Nov 2025 19:14:01 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> test/langtools/tools/javac/SuperInit/SuperInitFails.java line 282:
>> 
>>> 280:         class Inner9Test extends Medium {
>>> 281:             Inner9Test() {
>>> 282:                 boolean check1 = Inner9Test.super.check;
>> 
>> Should the test also use `Parent.super.check` and `Medium.super.check`?
>
> in those cases javac already fails with:
> 
> `error: not an enclosing class: ClassName`

I remember the original case provided uses `Interface.super.staticField`. So it's like we have this code in `Medium` instead; can we maybe make `Inner9Test` instead of `Medium` implement `Parent`?

-------------

PR Review Comment: https://git.openjdk.org/valhalla/pull/1740#discussion_r2535246835


More information about the valhalla-dev mailing list