[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 18:14:56 UTC 2025
On Mon, 1 Sep 2025 11:04:59 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> ok, so I guess I still don't get whether this _must_ be an error. In principle `y` could have a local proxy, in which case the lambda could be thought of as accessing that proxy, so no need to capture `this` ?
I wonder what is the mental model supposed to be here.
@mcimadamore what is your opinion on whether this should compile?
class A {
int y;
A() {
y = 1;
class B {
static void m() { // static context
System.out.println(y);
}
}
super();
}
}
If your answer is "No" then aren't you then implying that `y` shouldn't be available whenever `A.this` is not available? In which case doesn't that answer your question?
If your answer is "Yes", then doesn't that imply that _this_ should also compile...
class A {
int y;
A() {
y = 1;
class B {
static void m() { // static context
System.out.println(A.this.y);
}
}
super();
}
}
even though this doesn't:
class A {
int y;
A() {
y = 1;
class B {
static void m() { // static context
System.out.println(A.this);
}
}
super();
}
}
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1523#discussion_r2314430958
More information about the valhalla-dev
mailing list