Basically, I’m calling a now-deprecated Java static method which uses varargs…
MyClass.myMethod(arg1, arg2, arg3...);
…whose usages I need to replace with one that doesn’t.
MyClass.myNewMethod(arg1)
.addArg(arg2)
.addArg(arg3)
...
;
This replacement needs to happen in a large number of places across the code base, and the argument types, values, and code formatting can vary greatly, so a regex replacement isn’t really feasible. I’m looking to see if IntelliJ’s Structural Replace can help here. I wanted to see if anything like the following was possible:
Search template:
MyClass.myMethod($Arguments$)
Replacement template:
MyClass.myNewMethod(
for (argument : $arguments$) {
.addArg(argument)
}
)
Does IntelliJ IDEA’s Structural Search & Replace provide any sort of similar functionality?