No, I don't think /u/Deathspiral222 was saying that. What he was saying is that over your entire codebase, you have 12 functions named the same thing. He uses foo() as an example, but it could be something common like a getter called getName(). He now wants to rename the base function to bar() in one case. A find/replace won't help you here, since it will find calls to every foo() function, instead of only the specific one you want to rename.
I'm not sure how you can do that when talking about Java. Sure, you have the base case of "import com.bar.Something" where Something contains your foo method and I guess you can look for that but then you also need to look for things like "import com.bar.*" and then you also need to look for explicit references like:
"Foo foo = com.bar.Something.foo()"
and all those are doable but then you have to deal with code that extends Something like:
"public class SomethingTwo extends Something {
public void foo()"
and then you'll have to find both all code that references the file or extends the file.
and so on and so on.
Eventually you realize that you can't get all instances of a specific foo() without a crazy amount of coding.
Ah, I misunderstood you. So say you have 2 methods with the same name, but different signatures (same number of args though). Can you grep your codebase for calls to the specific method included in that file with those specific arg types?
2
u/Vile2539 Sep 25 '15
No, I don't think /u/Deathspiral222 was saying that. What he was saying is that over your entire codebase, you have 12 functions named the same thing. He uses foo() as an example, but it could be something common like a getter called getName(). He now wants to rename the base function to bar() in one case. A find/replace won't help you here, since it will find calls to every foo() function, instead of only the specific one you want to rename.