Move Method problems in Irida

I've noticed a lot of problems with Move Method ever since it came out. I
don't know if these are known problems, and Move Method is a Work In Progress,
or if I should file issue reports for these.

1. Dialog asks for original class instance variable even when no fields or
instance methods are used
(for example, when the method calls itself)

2. Dialog does not allow me to choose to move the method to a completely
unrelated class, and make it a static method.

3. Dialog UI is very confusing to me, longtime IDEA user
- "Select an instance variable:" - I understand this now, but my first reaction
was "why? what will it be used for?" I suggest something more like "This
method can be moved to any class which is used as a variable in the method.
This instance variable will become 'this' in the moved method. Choose a variable
to become 'this':"
- "Select a name for MethodAnalyzer.this parameter" - I think it should be
replaced with "This method references [instance methods and/or fields and/or
nonstatic inner classes] from the current class, so the moved method must
contain a parameter of this type. Choose a name for this parameter."

4. Multiple methods cannot be moved at once, as with moving static method

5. Moving a method where no parameter is created for the original class generates
broken code for callers of the moved method; they all pass a "this" but there
is no corresponding parameter for it

Are these all planned to be addressed or should I file issues for them?


2 comments
Comment actions Permalink


"Keith Lea" <keith@cs.oswego.edu> wrote in message
news:283710632506555270769184@news.jetbrains.com...

I've noticed a lot of problems with Move Method ever since it came out. I
don't know if these are known problems, and Move Method is a Work In

Progress,

or if I should file issue reports for these.

>

1. Dialog asks for original class instance variable even when no fields or
instance methods are used
(for example, when the method calls itself)


If you find such cases please report them to JIRA.

>

2. Dialog does not allow me to choose to move the method to a completely
unrelated class, and make it a static method.


No, it was not the intention of this refactoring. Make method static and
then move it as such.

>

3. Dialog UI is very confusing to me, longtime IDEA user
- "Select an instance variable:" - I understand this now, but my first

reaction

was "why? what will it be used for?" I suggest something more like "This
method can be moved to any class which is used as a variable in the

method.

This instance variable will become 'this' in the moved method. Choose a

variable

to become 'this':"
- "Select a name for MethodAnalyzer.this parameter" - I think it should be
replaced with "This method references [instance methods and/or fields

and/or

nonstatic inner classes] from the current class, so the moved method must
contain a parameter of this type. Choose a name for this parameter."



To verbose IMO, the dialog is not the help topic, any other suggestions?

>

4. Multiple methods cannot be moved at once, as with moving static method


Every method has its own candidates classes to move it to...

>

5. Moving a method where no parameter is created for the original class

generates

broken code for callers of the moved method; they all pass a "this" but

there

is no corresponding parameter for it


Please another request to JIRA.

Eugene.


0
Comment actions Permalink

>> 1. Dialog asks for original class instance variable even when no
>> fields or
>> instance methods are used
>> (for example, when the method calls itself)

If you find such cases please report them to JIRA.


I filed http://www.jetbrains.net/jira/browse/IDEA-1764

>> 2. Dialog does not allow me to choose to move the method to a
>> completely unrelated class, and make it a static method.
>>

No, it was not the intention of this refactoring. Make method static
and then move it as such.


I filed http://www.jetbrains.net/jira/browse/IDEA-1765 about improvement
to the UI.

>> 4. Multiple methods cannot be moved at once, as with moving static
>> method
>>

Every method has its own candidates classes to move it to...


http://www.jetbrains.net/jira/browse/IDEA-1765 addresses this as well.

>> broken code for callers of the moved method; they all pass a "this"
>> but

there

>> is no corresponding parameter for it
>>

Please another request to JIRA.


I filed http://www.jetbrains.net/jira/browse/IDEA-1763


0

Please sign in to leave a comment.