how to "introduce indirection" like in eclipse?
eclipse has this feature. it can find all usages of a method and replace it with another call which then calls the original one.
before:
class X {
void x() {...}
}
//somewhere else
x.x();
-----------------
after:
static void foo(X x) {x.x()}
//somewhere else foo is called instead of x
foo(x);
-----------
i can fake this partially by renaming a method, but there is manual plumbing involved. can idea do this automatically?
Please sign in to leave a comment.
I'd try to extract
x.x();
to a new static method foo.
that will only replace usages in one class, not everywhere
You know that you can trigger it for the whole project?
how? i can make it public and static, but i have no option for letting idea check the whole project
Refactor > Replace Method Code Duplicates