Let there be a method like this:
public int a() {
return 1 + b();
}
Is it possible to apply the “Introduce parameter” refactoring in eclipse on the expression b() such that the caller actually calls the method b on the callee? Like this:
o.a() // old
o.a( o.b() ) // new
When I do it, it basically copy&pastes the string “b()” into the call which doesn’t make sense of cause because this method is on the callee, not the caller. But maybe you know a trick?
Or, alternatively, is it possible to use the “Change Method Signature” refactoring and use an expression in the default value which references the callee? So that I could create a new parameter on a() and let it have a default value of something like ${this}.b()?
You can do this indirectly:
o.a()(call ita_tmp)a_tmpfromreturn o.a()toreturn o.a(o.b())a_tmp