On Fri, 15 Aug 2025 21:38:08 GMT, Vicente Romero <[email protected]> wrote:

> Before this fix only strict fields were readable in the prologue phase. The 
> proposed fix should allow any instance fields of identity classes to be 
> readable in the prologue phase. This implies changes in flow analysis as 
> before we were only tracking final and strict fields. There is also some 
> "cooperation" needed in the code to detect cases when reading a field is not 
> allowed in the prologue phase. For example some methods in Resolve don't have 
> all the needed information at the moment they are dealing with some ASTs and 
> part of the processing needs to be done in Attr
> 
> TIA

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1259:

> 1257:                     for (JCTree stat : tree.body.stats) {
> 1258:                         prologueCode.add(stat);
> 1259:                         // gather all the stats in the body until a 
> `super` or `this` invocation is found

I think this comment should explain that super/this invocation is included 
because its arguments are restricted too.

test/langtools/tools/javac/SuperInit/EarlyIndirectOuterCapture.java line 21:

> 19:         class InnerInnerOuter extends EarlyIndirectOuterCapture {   // 
> not accessible
> 20:             InnerInnerOuter() {
> 21:                 super(new InnerSuperclass() { }); // should this be 
> accepted?, InnerSuperclass is not an inner class of InnerInnerOuter

Probably yes, I think our agreement last time is that local/anonymous classes' 
captures, including the "outer this", are synthetic.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1523#discussion_r2280164233
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1523#discussion_r2280171982

Reply via email to