Bug 335674 - [extract method] wrong return type when extracting code from a cycle
Summary: [extract method] wrong return type when extracting code from a cycle
Status: CLOSED DUPLICATE of bug 213519
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-28 06:18 EST by kuba CLA
Modified: 2011-01-28 08:15 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kuba CLA 2011-01-28 06:18:08 EST
Build Identifier: 20090920-1017

In the following snippet extracting the marked code (the body of the second cycle) would lead to:
extracted(multiple3, j);
instead of
multiple3 = extracted(multiple3, j);
There is no warning shown, but it changes the result!

--------------- code snippet -----------------

String multiple3 = "";

System.out.println("Searching numbers: ");
//this for cycle has to be here! If commented it works fine.
for (int t = 1; t < 20; t++) {
	System.out.print(t + ", ");
}

for (int j = 1; j < 20 ; j++) {
	//try to extract following 4 lines to a method
	if (j % 3 == 0) {
		multiple3 = multiple3 + j + ", ";
	}
	System.out.println(multiple3);
}

Reproducible: Always
Comment 1 Ayushman Jain CLA 2011-01-28 06:47:14 EST
Moving to JDT/UI for comment.
Comment 2 Deepak Azad CLA 2011-01-28 08:15:01 EST
This works with 3.6, can you please try with that.

*** This bug has been marked as a duplicate of bug 213519 ***