Bug 15442 - extract method: could be allowed in void method even if not all returns selected [refactoring]
Summary: extract method: could be allowed in void method even if not all returns selec...
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: investigate
Depends on:
Blocks:
 
Reported: 2002-05-07 12:51 EDT by Adam Kiezun CLA
Modified: 2003-02-06 12:10 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Kiezun CLA 2002-05-07 12:51:11 EDT
20020502
package p;
class S{
	void f(int y){
		/*[*/if (y == 0)
			return;
		f(3);/*]*/
		f(4);	
	}
}

contrary to what the error message says all execution branches in the selected 
fragment do end with a return (the last is implicit) and it would be possible 
to extract a method here.

the method 'f' being void is important - only then is the implicit return added
Comment 1 Erich Gamma CLA 2002-05-07 16:29:29 EDT
defer
Comment 2 Dirk Baeumer CLA 2002-07-23 13:28:48 EDT
[refactoring]

Consider for 2.1
Comment 3 Dirk Baeumer CLA 2003-02-06 12:10:58 EST
This can't be allowed. Extracted the code into a method would change execution 
flow since the new code would always execute f(4);.