-
Bug
-
Resolution: Unresolved
-
P4
-
repo-valhalla
this code:
```
value class Test {
private final int[] data = new int[10];
Test() {
for (int i = 0; i < data.length; i++) {
data[i] = i;
}
}
}
```
should be accepted by javac without errors or initialization warnings, if enable, but it is rejected. Basically field data has an initializer and fields with initializers can't be assigned to in the prologue. But `data[i] = i` is assigning to an array component, not to the whole array.
```
value class Test {
private final int[] data = new int[10];
Test() {
for (int i = 0; i < data.length; i++) {
data[i] = i;
}
}
}
```
should be accepted by javac without errors or initialization warnings, if enable, but it is rejected. Basically field data has an initializer and fields with initializers can't be assigned to in the prologue. But `data[i] = i` is assigning to an array component, not to the whole array.