Push Down Refactoring Specification
$Id: pushdown.html,v 1.7 2005/08/25 14:25:00 jbecicka Exp $ (see full
CVS history)
This refactoring feature allows to "push down" type members (methods, fields, inner classes) and interfaces in the
implements clause into all direct subtypes of the type.
Implementation of this refactoring is tracked in
issue 56139.
Pre-Conditions
- A single type or 1 to many members from a single type are selected.
Pre-Checks
- [4.2] Error: The selected type (or the parent type of the selected fields and methods) has no subtypes.
- [4.2] Error: The selected type has no members.
Parameters
- List of members to push down to the subtype.
- For each method to be pushed down a boolean parameter to indicate whether it should be kept as abstract in the
current type
Fast Parameters Check
- At least one feature needs to be selected.
Parameters Check
- Warning: One of the selected members already exists in a subtype (won't be copied to that subtype).
- Warning: Method to be pushed down and marked as "Keep Abstract" is private or package private. (make it protected).
- Warning: Member selected to be pushed down is used by other members of the class that will not be pushed down.
(suggest pushing down other members)
- Warning: Member selected to be pushed down uses other members of the type that are not accessible from all
direct subtypes (are private or package private). (suggest pushing down other members)
- Warning: Member selected to be pushed down referances code from other classes that is not accessible from all
direct subtypes. (code will be broken after refactoring)
Changes To Be Made
- Remove the elements to be pushed down from the current type. In case of methods marked as "Keep Abstract" the
method should not be removed but rather modified (if necessary) to be abstract.
- Add the elements to be pushed down to all the subtypes that do not contain those elements already.
- Change modifiers of the pushed elements where necessary (see Parameters Check).
Checks During Changes Preparation
No specific checks.
Refactoring UI
Menu item:
Push Down...
Action title:
Push Down Members of "ClassName"
The panel should display a table containing all members in the current type (see the picture below). User can use
a checkboxes for individual members to indicate which member should be pushed down.
----------------------------------------
| Members to Push Down: |
| ------------------------------------ |
| | | Member | Keep Abstract | |
| ------------------------------------ |
| | o field1 | | |
| | x field2 | | |
| | o field3 | | |
| | o field4 | | |
| | x method1 | o | |
| | o method2 | o | |
| | x method3 | x | |
| ------------------------------------ |
----------------------------------------