A possible bug in JEP 482: Flexible Constructor Bodies
Ella Ananeva
ella.ananeva at oracle.com
Mon May 20 21:12:55 UTC 2024
Hi,
I found a discrepancy in the behavior of the JEP 482 compiler regarding definite assignment of a final non-static blank field in a prologue of a constructor:
Case 1
Case 2
Case 3
class Q {
final int x;
int y;
{ y = x; }
public Q(int a) {
x = a;
super();
}
}
class Q {
final int x;
int y;
{ y = x; }
public Q(int a) {
x = a;
this();
}
public Q() {}
}
class Q {
final int x;
int y;
{ y = x; }
public Q(int a) {
x = a;
}
}
Compilation succeeds
Compilation fails
Compilation fails
Shouldn’t the behavior in this 3 cases be similar?
Thank you,
Ella
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20240520/a7c89d43/attachment-0001.htm>
More information about the amber-dev
mailing list