Inline refactoring enhancement/bug? 5131

I just tried to inline "myString" in the code below by hitting CTRL-ALT-N,
where my cursor was positioned at the "|" character:

public String myMethod1(String myString) {
myString = myMethod2(myString);
return myS|tring;

I was hoping for the following result:

public String myMethod1(String myString) {
return myMethod2(myString);

however IDEA (build 5131) tells me the refactoring cannot be performed. Does
this sound like a reasonable feature request, or is it a bug in 5131?

1 comment
Comment actions Permalink

Yep, this feature, i.e. inline variable definition in case there is only one def reaching all uses of that def, was on my radar as well. Though for fields it is not safe to inline the definition, since there could be usages of that field in other methods, just for locals and parameters.


Please sign in to leave a comment.