Community
Participate
Working Groups
1) create the following class X.java public class X { void foo1() { final int x; int i = 0 for(;;) { x = i; // error } } void foo2() { final int x; int i = 0; while(true){ x = i; // no error continue; } } void foo3() { final int x; int i = 0; while(true){ x = i; // error //continue; } } void foo4() { final int x; int i = 0; do { x = i; // error continue; } while (true); } } 2) compile. foo1, foo3 and foo3 contain an error "The final variable x may already have been assigned" Compiler should report an error in foo2. Note: see bug 45433
Solved, while statement was missing merge of continue branch before diagnosing assignment in loops.
Backported to 2.1.x stream
Verified for 3.0M6
Verified for 2.1.3 with build M200402251535.