Bug 170986

Summary: [compiler] a variable is not seen as definitely assigned when it should
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Maxime Daniel <maxime_daniel>
Status: VERIFIED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 3.3   
Target Milestone: 3.3 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Olivier Thomann CLA 2007-01-18 20:06:48 EST
Using latest (v_731 + patch for bug 169017), compile the following code:

public class X {
	public void save() {
		int a = 3;
		try {
			Object warnings = null;
			Object contexts = null;
			try {
				System.out.print(warnings);
				return;
			} catch (NullPointerException npe) {
				System.out.print(contexts);
				return;
			} finally {
				System.out.print("#inner -> " + a);
			}
		} catch (Exception e) {
			return;
		} finally {
			int var = 0;
			System.out.println("#save -> " + a);
		}
	}
	public static void main(String[] args) {
		new X().save();
	}
}

in:
System.out.print(contexts);
return;

At the beginning of the return statement, the variable a is not seen as definitely assigned. With the patch for bug 169017, the initStateIndex of the return statement is -1. I would expect a state index that indicates that 'a' is definitely assigned.
Comment 1 Maxime Daniel CLA 2007-01-22 03:56:51 EST
From what I could see, the initStateIndex of the said return statement is not -1 at the end of the code analysis. If I did not miss anything, this is the code generation that would loose it then. Please let me know what you think.
Comment 2 Olivier Thomann CLA 2007-01-29 11:58:17 EST
Closing as INVALID.
Made obsolete with latest changes for stack maps.