FeaturesPluginsDocs & SupportCommunityPartners

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

  1. A single type or 1 to many members from a single type are selected.

Pre-Checks

  1. [4.2] Error: The selected type (or the parent type of the selected fields and methods) has no subtypes.
  2. [4.2] Error: The selected type has no members.

Parameters

  1. List of members to push down to the subtype.
  2. 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

  1. At least one feature needs to be selected.

Parameters Check

  1. Warning: One of the selected members already exists in a subtype (won't be copied to that subtype).
  2. Warning: Method to be pushed down and marked as "Keep Abstract" is private or package private. (make it protected).
  3. 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)
  4. 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)
  5. 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

  1. 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.
  2. Add the elements to be pushed down to all the subtypes that do not contain those elements already.
  3. 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       | |
| ------------------------------------ |
----------------------------------------
Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Virtual Box - full virtualizer  Open ESB - The Open Enterprise Service Bus Powered by