On Thu, 4 Jun 2026 00:18:23 GMT, Vicente Romero <[email protected]> wrote:
>> When dealing with strict fields with initializers at the time we track them >> there is no constructor that we can use to later retrieve them at lowering >> time. Those fields can drop on the floor and no proxies are created for >> them. This PR fixes this issue, >> >> TIA >> >> >> >> >> --------- >> - [X] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Vicente Romero has updated the pull request incrementally with one additional > commit since the last revision: > > review comments src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LocalProxyVarsGen.java line 124: > 122: earlyReads = fieldsReadInPrologue.get(classDecl); > 123: fieldsReadInPrologue.remove(classDecl); > 124: } Suggestion: Set<Symbol> earlyReads = fieldsReadInPrologue.remove(classDecl); However I wonder if this removing for one constructor is right - we might need to duplicate initializers to multiple constructors. src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LocalProxyVarsGen.java line 131: > 129: earlyReads.addAll(fieldsReadInPrologue.get(tree)); > 130: } > 131: fieldsReadInPrologue.remove(tree); Suggestion: Set<Symbol> constructorEarlyReads = fieldsReadInPrologue.remove(tree); if (earlyReads == null) { earlyReads = constructorEarlyReads; } else { earlyReads.addAll(constructorEarlyReads); } ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2507#discussion_r3353247033 PR Review Comment: https://git.openjdk.org/valhalla/pull/2507#discussion_r3353262042
