| JDK 20 |
|---|
| 20 b22Fixed |
|
CSR :
|
|
|
Relates :
|
|
|
Relates :
|
File: Demo.java
public class Demo {
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
Runnable r = () -> System.out.println(i);
r.run();
break;
}
}
}
Expected: compilation failure (as "i" is not effectively final)
Observed: javac compiles without error.
Source: compiler-dev email
https://mail.openjdk.org/pipermail/compiler-dev/2022-September/020481.html
|