Bug 53507 - [refactoring] Inline parameter expression ("extroduce parameter")
Summary: [refactoring] Inline parameter expression ("extroduce parameter")
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 107855 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-02 12:33 EST by Markus Keller CLA
Modified: 2010-11-04 06:44 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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. ***