ABSTRACT
We will demonstrate several advanced refactorings for Java that have been implemented in the context of the Eclipse development environment for Java (see <b>www.eclipse.org</b>). These refactorings are semantics-preserving program transformations that are typical of the sorts of transformations object-oriented programmers perform manually in order to improve the structure of existing code, and to promote reuse, clarity, and extensibility.
Our demonstration will consist of three parts: (i) a quick review of the implementation in Eclipse of several widely-used refactorings such as <sc>Extract Method</sc>, <sc>Introduce Factory</sc> and <sc>Change Method Signature</sc> as described in Fowler's seminal book on refactoring, (ii) a demonstration of generalization-related refactorings such as <sc>Extract Interface</sc>, for extracting an interface from a class in order to reduce client dependencies on implementation particulars, and <sc>Generalize Type</sc>, for remediating over-specific declarations, and (iii) a demonstration of <sc>Genericize Container Uses</sc>, a refactoring that we are currently developing for migrating occurrences of standard container classes such as <b>ArrayList</b> or <b>HashMap</b> in a user's program to instantiations of the generic versions of these container classes in Java 1.5 (e.g., <b>ArrayList<String></b>). This involves determining the element types that flow into each container object, modifying their declarations and allocations sites where possible, and removing casts that have been rendered redundant.
The latter two categories of refactorings involve non-trivial static analysis, as well as challenging usability issues from a software engineering perspective, which reflect the complications that programmers face when performing the transformations manually. Therefore, during each demonstration, we will give a brief overview of the technical challenges that the refactorings present, along with highlights of the approach we took in addressing them. In particular, we will briefly describe a new piece of Eclipse infrastructure designed to help implement various kinds of context-sensitive and context-insensitive type and pointer analyses for Java.
- Refactoring: Improving the Design of Existing Code, Martin Fowler, Addison-Wesley, 1999. Google ScholarDigital Library
- Refactoring for Generalization using Type Constraints", Frank Tip, Adam Kieżun., Dirk BÄaumer, Proceedings of 2003 OOPSLA, pp. 13--26. Google ScholarDigital Library
- Integrating Refactoring Support into a Java Development Tool", Dirk BÄaumer, Erich Gamma, Adam Kieżun, OOPSLA 2001 Companion.Google Scholar
- Eclipse "New and Noteworthy" page describing Extract Interface: http://fullmoon.torolab.ibm.com/downloads/drops/R-2.1-200303272130/whats-new-jdt-refactor.html Eclipse "New and Noteworthy" page describing Generalize Type and Introduce Factory: http://fullmoon.torolab.ibm.com/downloads/drops/S-3.0M5-200311211210/eclipse-news-part1-M5.htmlGoogle Scholar
Index Terms
- Advanced refactorings in eclipse
Recommendations
Deriving refactorings for aspectJ
OOPSLA '04: Companion to the 19th annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applicationsIn this paper we present aspect-oriented programming laws that are useful for deriving refactorings for AspectJ. The laws help developers to verify if the transformations they define preserve behavior. We illustrate that by deriving several AspectJ ...
Star diagram with automated refactorings for Eclipse
eclipse '05: Proceedings of the 2005 OOPSLA workshop on Eclipse technology eXchangeOne of the powerful features of the Eclipse JDT plug-in is its refactoring feature. Yet, because many refactorings are global and architectural in nature, the textual presentation of refactorings presents challenges for designers. We have designed and ...
Comments