Bug 84416

Summary: Stepping into message send without receiver should highlight message before sending message
Product: [Eclipse Project] JDT Reporter: Jerome Lanneluc <jerome_lanneluc>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Jerome Lanneluc CLA 2005-02-04 04:39:17 EST
I20050202

1. Create the following cu:
public class X {
	void foo(String[] array, String s) {
		System.out.println(array + s);
	}
	void bar() {
		foo( // breakpoint here
			new String[] {},
			"");
	}
	public static void main(String[] args) {
		new X().bar();
	}
}
2. Add a breakpoint where indicated
3. Debug
4. When the breakpoint is hit, step into (F5) 3 times
Observe: On the third "step into", the method foo is entered, but it was the
argument "" that was highlighted.

If you change the test case as follows (just adding 'this' as the receiver):
public class X {
	void foo(String[] array, String s) {
		System.out.println(array + s);
	}
	void bar() {
		this.foo( // breakpoint here
			new String[] {},
			"");
	}
	public static void main(String[] args) {
		new X().bar();
	}
}
then foo is entered only on the 4th step (as expected).
Comment 1 Olivier Thomann CLA 2005-02-04 14:46:32 EST
The difference between the two examples is that an explicit this (second case)
adds its own entry in the line number table attributes. The fix would be to add
a fake entry when the this is implicit.
I will investigate.
Comment 2 Olivier Thomann CLA 2005-02-04 21:33:18 EST
Changes required in:
ArrayReference.java
FieldReference.java
MessageSend.java
QualifiedNameReference.java
Reference.java
SingleNameReference.java

Now the two scenarii are identical in term of stepping.
Comment 3 Olivier Thomann CLA 2005-02-04 23:30:12 EST
Fixed and released in HEAD.
Comment 4 David Audel CLA 2005-02-16 13:00:02 EST
Verified in I20050215-2300