Javac accepts this code:
abstract value class ValueParent {
int b = 5;
}
value class ValueClass extends ValueParent {
int a = b;
}
according to the spec this should be rejected as the initializer will run in the prologue phase and there is a reference to a super class field. If ValueClass is modified to the "equivalent" version below, javac does issue an error:
value class ValueClass extends ValueParent {
int a;
ValueClass() {
a = b;
super();
}
}
reported by Ella Ananeva
abstract value class ValueParent {
int b = 5;
}
value class ValueClass extends ValueParent {
int a = b;
}
according to the spec this should be rejected as the initializer will run in the prologue phase and there is a reference to a super class field. If ValueClass is modified to the "equivalent" version below, javac does issue an error:
value class ValueClass extends ValueParent {
int a;
ValueClass() {
a = b;
super();
}
}
reported by Ella Ananeva
- links to
-
Review(lworld)
openjdk/valhalla/1728