Extract Method bug

I stumbled across a problem this morning and have tried to distill it down to the basic situation.

I was doing an Extract Method of some code inside a foreach loop. The extracted code has a return statement in the middle.

Before Refactoring:

After Refactoring:

The refactored code doesn't preserve behavior which is a BadThing™. I seem to remember Eclipse issuing a warning about this situation in Java code (multiple return paths?) but am not at a machine where I can verify that.


Comment actions Permalink

Oops - this appears to duplicate #5003. Sorry!


Please sign in to leave a comment.