Bug 68863 - Missing entry in local variable attribute
Summary: Missing entry in local variable attribute
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-29 10:27 EDT by Philipe Mulet CLA
Modified: 2004-09-06 10:22 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2004-06-29 10:27:28 EDT
R3.0

On following code, we are not generating the proper variable entry in local 
variable attribute:

public class X {
	public static void main(String[] args) {
		int i;	
		outer: {
			if (args == null) {
				i = 0;
				break outer;
			}
			return;
		}
		System.out.println(i);	// no entry in var attribute
	}
}

Thus if breaking in debugging on println(i) line, the variable 'i' isn't 
visible where it should be.
Comment 1 Philipe Mulet CLA 2004-06-29 10:36:16 EDT
we should generate sthg like:

      Local variable table:
        [pc: 6, pc: 9] local: i index: 1 type: I
        [pc: 0, pc: 18] local: args index: 0 type: [Ljava/lang/String;
        [pc: 10, pc: 18] local: i index: 1 type: I
Comment 2 Philipe Mulet CLA 2004-06-29 11:45:02 EDT
Similar issue with do-while statement.
Comment 3 Philipe Mulet CLA 2004-06-29 11:51:47 EDT
Similar issue for all control flow statements (including foreach).
Comment 4 Philipe Mulet CLA 2004-06-29 11:56:50 EDT
The following templates where missing #addDefinitelyAssignedVariables.

if (mergedInitStateIndex != -1) {
  codeStream.removeNotDefinitelyAssignedVariables(
    currentScope, mergedInitStateIndex);
  codeStream.addDefinitelyAssignedVariables(      
    currentScope, mergedInitStateIndex);
}
codeStream.recordPositionsFrom(pc, this.sourceStart);
Comment 5 Philipe Mulet CLA 2004-06-29 12:23:35 EDT
Could be backported to 3.0 maintenance stream.

Fixed in 1.5 stream, added regression tests: ConformTest#test241-244 + 
ForeachStatementTest#test027.
Comment 6 Philipe Mulet CLA 2004-06-30 07:22:50 EDT
Backported to 3.0.x stream.
Comment 7 David Audel CLA 2004-09-06 10:22:42 EDT
Verified for 3.0.1 RC1