Bug 47082

Summary: [Compiler] Problem with final variable initialization
Product: [Eclipse Project] JDT Reporter: David Audel <david_audel>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 2.1.3   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description David Audel CLA 2003-11-20 09:27:58 EST
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
Comment 1 Philipe Mulet CLA 2003-11-23 07:19:29 EST
Solved, while statement was missing merge of continue branch before diagnosing 
assignment in loops.
Comment 2 Philipe Mulet CLA 2003-11-25 07:00:09 EST
Backported to 2.1.x stream
Comment 3 David Audel CLA 2003-12-17 10:46:24 EST
Verified for 3.0M6
Comment 4 Frederic Fusier CLA 2004-03-01 13:36:33 EST
Verified for 2.1.3 with build M200402251535.