Bug 127255 - [compiler] Compiler incorrectly reports "variable may not have been initialized"
Summary: [compiler] Compiler incorrectly reports "variable may not have been initialized"
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Maxime Daniel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-10 08:54 EST by Fares Abdullah CLA
Modified: 2006-02-14 09:02 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fares Abdullah CLA 2006-02-10 08:54:42 EST
Reproduced with Eclipse 3.2 Integration build: 20060208
OS: Windows XP
eclipse-SDK-I20060208-0848-win32.zip

Test Case:
public class Test {
	public void test() {
		int ch;
		while ((char)(ch = 0) == 1) {};
		if (ch == -1) ; // Compiler underlines "ch" and says that it may not have been initialized
	}
}

This is not a problem with Eclipse 3.2M4.
Comment 1 Maxime Daniel CLA 2006-02-10 10:29:00 EST
Only happens in compliance 1.3 mode.
Comment 2 Maxime Daniel CLA 2006-02-10 10:39:02 EST
Fixed and released in HEAD.
Change is a better flow info composition into WhileStatement#analyseCode for the empty block, compliance <= 1.3 branch.
Added test cases to FlowAnalysisTest (2 to 5).
Verification can leverage the original test case, in 1.3 compliance level.
Comment 3 Jerome Lanneluc CLA 2006-02-14 09:02:22 EST
Verified for 3.2 M5 using build I20060214-0010