You almost read my thoughts! :-) I have been thinking about this refactoring for the last few days already.
> 2) Add an new method parameter for the instance and use this instance for > accessing instance methods/fields. One small addition. In case when only some instance fields are used (not methods), there should be an option to pass these fields as parameters instead of passing the whole instance. In fact, I was thinking about this refactoring in context of other 2 refactorings that should, together with moving of static methods, allow to move non-static methods in the majority of cases. One refactoring is "Make non-static". It should make a static method non-static. There should be a way to specify an expression to be used as instance object for all invokations. It could either be an independent expression or one depending on the parameters of the call. Another refactoring is an addition to "Remove Parameter". In case when parameter to be removed is used in the body of the method, there should be an option to replace usages of the parameter with some expression. This expression can be often auto-suggested by IDEA, for example, in the situation when value of this parameter passed in each call is the same constant or can be easily calculated from the context. By analysing many situations when I wished to move an instance method to another class, I found that this could be done by combining these 4 refactorings (Make Method Static, Move Static Method, Make Method Non-Static, advanced Remove Parameter). Best regards, Valentin Kipiatkov ----------------------------------------------------------- IntelliJ Software, http://www.intellij.com/ "Develop with pleasure" ----------------------------------------------------------- ----- Original Message ----- From: "Thomas Singer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 24, 2001 12:02 PM Subject: [Eap-list] Comment to Move member > Hello, > > currently the Move member allows only to move static methods (and fields, > but I know want to talk about methods only). > > Since the move instance method is really a pain to implement (I guess), I > would find it really cool to have an extra refactoring "Make static", that > makes instance methods static (I guess, this is much easier to implement). > Than you can move the static method easily around the project. > > 1) Check, whether the instance method uses any other instance method or > instance field. If not, only put the "static" keyword before the definition > and finish. > > 2) Add an new method parameter for the instance and use this instance for > accessing instance methods/fields. > > Best regards > Thomas Singer > _____________ > regnis.de > > > _______________________________________________ > Eap-list mailing list > [EMAIL PROTECTED] > http://www.intellij.com/mailman/listinfo/eap-list _______________________________________________ Eap-list mailing list [EMAIL PROTECTED] http://www.intellij.com/mailman/listinfo/eap-list
