Reputation: 2407
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()
?
Upvotes: 1
Views: 295
Reputation: 32407
You can do this indirectly:
o.a()
(call it a_tmp
) a_tmp
from return o.a()
to return o.a(o.b())
a_tmp
Upvotes: 2