[lworld] RFR: 8359370: [lworld] allow instance fields of identity classes to be readable in the prologue phase [v15]

Archie Cobbs acobbs at openjdk.org
Mon Sep 1 19:38:57 UTC 2025


On Mon, 1 Sep 2025 18:33:54 GMT, Maurizio Cimadamore <mcimadamore 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)

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).

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

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


More information about the valhalla-dev mailing list