[lworld] RFR: 8368795: [lworld] javac rejects assignments to components of array fields with initializers in the prologue
Vicente Romero
vromero at openjdk.org
Thu Oct 9 11:20:31 UTC 2025
On Mon, 6 Oct 2025 21:30:25 GMT, Chen Liang <liach at openjdk.org> wrote:
>> still a work in progress
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1451:
>
>> 1449: // Field may not have an initializer
>> 1450: if ((sym.flags() & HASINIT) != 0) {
>> 1451: if (!sym.type.hasTag(ARRAY) || !isIndexed) {
>
> Does this work for complex ones like `(this.a = stuff)[b] = 5`?
>
> Maybe we can try updating `isInLHS` to point to a JCTree and all the tests to be something like `tree == isInLHS` so this just won't run for array indexed trees?
at least this test case is handled correctly, it could be that other cases won't be treated properly but we would need a test case
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1664#discussion_r2416436916
More information about the valhalla-dev
mailing list