Open tombentley opened 12 years ago
Dunno, won't that be almost always? :) I mostly use refactorings to change names, yes sometimes of local things only, but often of class and method names. Doesn't mean it's a bad idea though.
Dunno, won't that be almost always? :)
As a precursor to this we'll need to document what the 'safe' refactorings actually are, but there are definitely some which I would expect to be binary compatiable:
shared
membershared
member in a non-shared
packageNot all of those are eclipse refactorings of course.
You use refactoring for all those? I use them only for renaming things to be honest, those things that would really take a lot of work to do by hand. But never in my life have I used automation to add a method or a parameter. People really do that?
No, of course I don't use refactoring for all those! I mainly use it for renaming/moving, changing method signatures and extracting methods, locals and fields. (I'm sure there are people who would add a parameter via a refactoring though).
I think the "Renaming a shared
member in a non-shared
package" one is interesting though. It's perfectly possible in a large codebase that you won't remember which packages are shared outside the module. You can look it up, of course but that takes too long. Having the IDE tell you that it's not OK to rename is particularly useful in that case.
I've just are an even awsomer idea though: We could detect when the user is adding a parameter to a method as they type and have a little paperclip cartoon character that pops up and says: "It looks like you're adding a parameter to a method, would you like me to help you add a default value to preserve binary compatibility?"
That would be extremely cool, but it would become nuisance (or just ignored) if it would appear each time when you add a parameter, you might just be writing new code. So how do we detect that? Somehow see if there are previous module versions for example?
I agree it would have to be done well to avoid being really annoying (hence my reference to Clippy from MS Office).
We might want a per-project option to turn it on. Then we could use more fine-grained info than simply the existence of a previous version of the module. We could compare the declaration at the cursor to the most recently published declaration. That way we'd know not to warn about someone adding a parameter to a new method (i.e. that was not declared in the previous version, so no one could possibly depend on it).
It would be really cool if, when performing a refactoring, the IDE could warn you that it was going to affect binary or source compatibility.