[lworld] RFR: 8359370: [lworld] allow instance fields of identity classes to be readable in the prologue phase [v15]
Vicente Romero
vromero at openjdk.org
Mon Sep 1 20:19:52 UTC 2025
On Mon, 1 Sep 2025 19:35:59 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:
>> (in your example with static context, my answer is that no, it should _not_ compile. A static context can't access instance fields from an enclosing class)
>
>> (in your example with static context, my answer is that no, it should _not_ compile. A static context can't access instance fields from an enclosing class)
>
> Yep, sorry that was a dumb example - I should have replaced the static context with a lambda.
>
> I'm all for increased flexibility, it's just that it would be nice if that came with a clean mental model.
>
> For example, one possible mental model could be "works like effectively final" - which I think is what you're advocating - but for that we'd have to break the equivalence between `y` and `A.this.y` (probably worth it).
I guess that we should discuss access from a lambda with Dan, and if we decide the rules should be relaxed then do it but I think as part of a future PR. I'm also all in for relaxing restrictions
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1523#discussion_r2314534459
More information about the valhalla-dev
mailing list