[lworld] RFR: 8368795: [lworld] javac rejects assignments to components of array fields with initializers in the prologue
Chen Liang
liach at openjdk.org
Thu Oct 9 10:46:44 UTC 2025
On Mon, 6 Oct 2025 16:01:39 GMT, Vicente Romero <vromero at openjdk.org> wrote:
> still a work in progress
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1363:
> 1361: @Override
> 1362: public void visitIndexed(JCArrayAccess tree) {
> 1363: boolean previewIsIndexed = isIndexed;
Do you mean `previousIsIndexed`?
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?
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1664#discussion_r2408645969
PR Review Comment: https://git.openjdk.org/valhalla/pull/1664#discussion_r2408677604
More information about the valhalla-dev
mailing list