Bug 53507

Summary: [refactoring] Inline parameter expression ("extroduce parameter")
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: akiezun, daniel_megert
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2004-03-02 12:33:02 EST
When refactoring procedural code, you often have to remove parameters and inline
the expression which is used as actual argument.

We should have a refactoring which inlines a selected actual argument expression
in a method call. It should remove the parameter in the method declaration and
in calls to the method, and replace usages of the parameter by the selected
expression.

Example:
  void update(Node node) {
     // use node without assigning to it:
     ... node.getParent() ...
  }
  void callerOne() { ... update(getNode()) ... } // or update(fNode), ...
  void callerTwo() { ... update(getNode()) ... } // or update(fNode), ...
  ...
==> inline "getNode()" ==>
  void update() { ... getNode().getParent() ... }
  void callerOne() { update() }
  ...
Comment 1 Martin Aeschlimann CLA 2004-03-04 04:56:51 EST
the change signature refactoring could have this feature: for each removed
parameter: create a local variable for it if the reference is still used and
initialize it if all callers use it with the same expression (which is not very
often the case, e.g. in you example, your method could have side effects and the
refactoring would be a program change)
Comment 2 Markus Keller CLA 2006-06-09 12:24:45 EDT
*** Bug 107855 has been marked as a duplicate of this bug. ***