-
Task
-
Resolution: Fixed
-
P4
-
None
-
master
JEP 482 spec states that
It is a compile-time error if a qualified `this` expression occurs in an
early construction context ([8.8.7.1]) of the class named by *TypeName*.
However, this code compiles with JDK-23 b 25:
static class Test {
int a;
Test() {}
Test(int a) {
Test.this.a = 1;
this();
}
}
public static void main(String argv[]) {
Test test = new Test(1);
}
Per email discussion, the compiler implements a more sophisticated treatment of qualified this, thus the discrepancy. The specification should address this change.
It is a compile-time error if a qualified `this` expression occurs in an
early construction context ([8.8.7.1]) of the class named by *TypeName*.
However, this code compiles with JDK-23 b 25:
static class Test {
int a;
Test() {}
Test(int a) {
Test.this.a = 1;
this();
}
}
public static void main(String argv[]) {
Test test = new Test(1);
}
Per email discussion, the compiler implements a more sophisticated treatment of qualified this, thus the discrepancy. The specification should address this change.