Community
Participate
Working Groups
If necessary, pass the instance as method parameter
*** This bug has been marked as a duplicate of 10605 ***
Sorry, it is no direct duplicate of bug 10605. I want to make the current selected method to become static, passing the instance as parameter if necessary. bug 10605 wants to make all methods in a class static without passing the instance as parameter if required.
If you can convert all you can also convert only one. But, I guess if we do it we would only work on one. The refactoring would allow you to chose to pass the instance or select the fields that go in as parameters. But passing the instance is the most likely scenario. *** This bug has been marked as a duplicate of 10605 ***
I don't understand why this case is closed. It is still (eclipse 3.2.2) not possible to refactor a method to static, if it contains access to instance-fields.
Reopened this issue
*** Bug 10605 has been marked as a duplicate of this bug. ***
Please note, that Bug 10605 differs from this one, that it wants all possible methods to be converted to static where as this one just wants to make the current selected method static, even when it uses instance methods/variables.
>Please note, that Bug 10605 differs from this one Correct.
This refactoring will do something similar to Move Instance Method (add a parameter for 'this'), so we should also try to share the implementation.
Moving to M5..
Moving to M6..
*** Bug 338449 has been marked as a duplicate of this bug. ***
A simple workaround is to create the static method, call this static method from the method you want to become static and inline the method call. This works for me in 4.3.1.