Skip to content

Refactoring list

The following refactoring operations have been automated in CodART. Click on refactoring name to see the API and code.

Table 1. Refactoring operations

Refactoring Definition Entities Roles
Move class Move a class from a package to another package class source package, target package moved class
Move method Move a method from a class to another. class method source class, target class moved method
Merge packages Merge the elements of a set of packages in one of them package source package, target package
Extract/Split package Add a package to compose the elements of another package package source package, target package
Extract class Create a new class and move fields and methods from the old class to the new one class method source class, new class moved methods
Extract method Extract a code fragment into a method method statement source method, new method moved statements
Inline class Move all features of a class in another one and remove it class source class, target class
Move field Move a field from a class to another class field source class, target class field
Push down field Move a field of a superclass to a subclass class field super class, sub classes move field
Push down method Move a method of a superclass to a subclass class method super class, sub classes moved method
Pull up field Move a field from subclasses to the superclass class field sub classes, super class moved field
Pull up method Move a method from subclasses to the superclass class method sub classes, super class moved method
Increase field visibility Increase the visibility of a field from public to protected, protected to package or package to private class field source class source filed
Decrease field visibility Decrease the visibility of a field from private to package, package to protected or protected to public class field source class source filed
Make field final Make a non-final field final class field source class source filed
Make field non-final Make a final field non-final class field source class source filed
Make field static Make a non-static field static class field source class source filed
Make field non-static Make a static field non-static class field source class source filed
Remove field Remove a field from a class class field source class source filed
Increase method visibility Increase the visibility of a method from public to protected, protected to package or package to private class method source class source method
Decrease method visibility Decrease the visibility of a method from private to package, package to protected or protected to public class method source class source method
Make method final Make a non-final method final class method source class source method
Make method non-final Make a final method non-final class method source class source method
Make method static Make a non-static method static class method source class source method
Make method non-static Make a static method non-static class method source class source method
Remove method Remove a method from a class class method source class source method
Make class-final Make a non-final class final class source class
Make class non-final Make a final class non-final class source class
Make class abstract Change a concrete class to abstract class source class
Make class concrete Change an abstract class to concrete class source class
Extract subclass Create a subclass for a set of features class method source class, new subclass moved methods
Extract interface Extract methods of a class into an interface class method source class, new interface interface methods
Inline method Move the body of a method into its callers and remove the method method source method, callers method
Collapse hierarchy Merge a superclass and a subclass class superclass, subclass
Remove control flag Replace control flag with a break class method source class source method
Replace nested conditional with guard clauses Replace nested conditional with guard clauses class method source class source method
Replace constructor with a factory function Replace constructor with a factory function class source class
Replace exception with test Replace exception with precheck class method source class source method
Rename field Rename a field class field source class source filed
Rename method Rename a method class method source class source method
Rename class Rename a class class source class
Rename package Rename a package package source package
Encapsulate field Create setter/mutator and getter/accessor methods for a private field class field source class source filed
Replace parameter with query Replace parameter with query class method source class source method
Pull up constructor body Move the constructor class method subclass class, superclass constructor
Replace control flag with break Replace control flag with break class method source class source method
Remove flag argument Remove flag argument class method source class source method
Total 47