Sorry for the previous incomplete post. I hit send instead of save (they are very close in Outlook). ;-(

 

Anyway I run into the following problem a lot.

 

I want to extract these 2 lines into a method.

 

log("error");

throw new Exception("message”);

       

I also want to have “error” and “message” to be parameters to my method.

 

Right now I do extract variable on both of them

 

String error = “error”;

String message = “message”;

Log(error);

Throw new Exception (message);

 

Then I extract my 2 lines and inline the 2 temps back

 

This means that to extract this method I have to do 5 refactorings.

 

I would be nice if the extract method would allow to pick expressions within the extracted area to pass as parameter and to keep on the call site side.

 

 

Reply via email to