Reputation: 4319
I've got two static methods in a Java class :
public class MyFoo {
public static ClassA foo(ParameterA pa, ParameterB pb, ParameterC c)
// some implementation
}
public static ClassB bar(ParameterA pa, ParameterB pb, ParameterC c) {
// some implementation
}
}
And an implementation of ClassA with a method :
public class ClassA {
public ClassB baz() {
// some implementation
}
}
Method bar()
was introduced as a new feature and basically it replaces MyFoo.foo(a, b, c).baz()
. I'd like to refactor such calls to MyFoo.bar(a, b, c)
. Is it possible to do this in any IDE? I'm using IntelliJ IDEA, but tips for any IDE are welcome.
Upvotes: 0
Views: 617
Reputation: 4319
IntelliJ IDEA has Structural search and replace functionality, which allows me to reach my goal.
Upvotes: 0
Reputation: 1781
If you have all the code which ever calls bar()
- you can open every project in the universe which links against your code, then:
bar()
methodfoo()
to bar()
foo()
methodbar()
methodUpvotes: 0
Reputation: 4213
In Netbeans you can use the Inspect and Transform functionality. You can write your custom script doing stuff like that. It can then be run on a set of files or by clicking a sidebar hint. See also this and this blog entry.
Upvotes: 1