Bug 84416 - Stepping into message send without receiver should highlight message before sending message
Summary: Stepping into message send without receiver should highlight message before s...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-04 04:39 EST by Jerome Lanneluc CLA
Modified: 2005-02-16 13:00 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 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