[lworld] RFR: 8369860: [lworld] Javac generates duplicate initializer code
Chen Liang
liach at openjdk.org
Mon Oct 20 18:20:38 UTC 2025
On Fri, 17 Oct 2025 22:26:11 GMT, Vicente Romero <vromero at openjdk.org> wrote:
> For code like:
>
>
> value class Test {
> static class Foo {
> int x;
> int getX() { return x; }
> }
> private final Foo data = new Foo();
> Test() {
> data.getX();
> super();
> }
> }
>
>
> javac generates code corresponding to the initialization of field `data` twice, which is incorrect
Can we just append the variable initializers to the initBlocks in the `(sym.flags() & STATIC) == 0` branch in normalizeDefs?
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/1686#issuecomment-3423238688
More information about the valhalla-dev
mailing list