Earlier quoted context omitted.
These Java features are ruined by not allowing mutable variables to be captured. Having to do the 1-element array trick when the compiler could just do it for me is insane. If you are making JavaScript look good you are failing as a language.
You mean not having the error that go just fixed by changing the language is a problem?
Here's JS showing the same issue.
for (var i = 0; i i)
}
array.forEach((fn) => console.log(fn())) // Prints 10 every time.
The correct fix is that each loop iteration gets a fresh i instead of i just being mutated. Currently you can't see the difference in Java between there-is-only-one-i and there-is-a-fresh-i-every-time, so Java is free to do this right.