Bug 170986 - [compiler] a variable is not seen as definitely assigned when it should
Summary: [compiler] a variable is not seen as definitely assigned when it should
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M5   Edit
Assignee: Maxime Daniel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-18 20:06 EST by Olivier Thomann CLA
Modified: 2007-02-06 06:22 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.