|
ABSTRACT
Descriptive names are crucial to understand code. However, good names are notoriously hard to choose and manually changing a globally visible name can be a maintenance nightmare. Hence, tool support for automated renaming is an essential aid for developers and widely supported by popular development environments. This work improves on two limitations in current refactoring tools: too weak preconditions that lead to unsoundness where names do not bind to the correct declarations after renaming, and too strong preconditions that prevent renaming of certain programs. We identify two main reasons for unsoundness: complex name lookup rules make it hard to define sufficient preconditions, and new language features require additional preconditions. We alleviate both problems by presenting a novel extensible technique for creating symbolic names that are guaranteed to bind to a desired entity in a particular context by inverting lookup functions. The inverted lookup functions can then be tailored to create qualified names where otherwise a conflict would occur, allowing the refactoring to proceed and improve on the problem with too strong preconditions. We have implemented renaming for Java as an extension to the JastAdd Extensible Java Compiler and integrated it in Eclipse. We show examples for which other refactoring engines have too weak preconditions, as well as examples where our approach succeeds in renaming entities by inserting qualifications. To validate the extensibility of the approach we have implemented renaming support for Java 5 and AspectJ like inter-type declarations as modular extensions to the initial Java 1.4 refactoring engine. The renaming engine is only a few thousand lines of code including extensions and performance is on par with industrial strength refactoring tools.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
|
 |
2
|
|
| |
3
|
AspectJ Development Tools 1.5.1. http://www.eclipse.org/ajdt.
|
| |
4
|
John Brant and Don Roberts. The Smalltalk Refactoring Browser. http://st-www.cs.uiuc.edu/users/brant/Refactory/, 1999.
|
 |
5
|
Ittai Balaban , Frank Tip , Robert Fuhrer, Refactoring support for class library migration, Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming, systems, languages, and applications, October 16-20, 2005, San Diego, CA, USA
|
 |
6
|
|
| |
7
|
Márcio Lopes Cornélio. Refactorings as Formal Refinements. Ph.D. thesis, Universidade Federal de Pernambuco, 2004.
|
 |
8
|
|
 |
9
|
Alan Donovan , Adam Kiežun , Matthew S. Tschantz , Michael D. Ernst, Converting java programs to use generic libraries, Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, October 24-28, 2004, Vancouver, BC, Canada
|
| |
10
|
Eclipse 3.3.1. http://www.eclipse.org, 2007.
|
| |
11
|
Torbjörn Ekman, Ran Ettinger, Max Schäfer, and Mathieu Verbaere. Refactoring bugs in Eclipse, IDEA and Visual Studio, 2008. http://progtools.comlab.ox.ac.uk/refactoring/bugreports.
|
| |
12
|
Torbjörn Ekman and Görel Hedin. Modular name analysis for Java using JastAdd. In Generative and Transformational Techniques in Software Engineering, International Summer School, GTTSE 2005, volume 4143 of LNCS. Springer, 2006.
|
 |
13
|
|
| |
14
|
Ran Ettinger. Refactoring via Program Slicing and Sliding. D.Phil. thesis, Computing Laboratory, Oxford, UK, 2007.
|
| |
15
|
Martin Fowler. Refactoring: improving the design of existing code. Addison Wesley, 2000.
|
| |
16
|
|
| |
17
|
|
| |
18
|
Stefan Hanenberg, Christian Oberschulte, and Rainer Unland. Refactoring of Aspect-Oriented Software. In Net.ObjectDays, 2003.
|
| |
19
|
JBuilder 2007. http://www.codegear.com/products/jbuilder, 2007.
|
| |
20
|
IntelliJ IDEA 7.0.1. http://www.jetbrains.com, 2007.
|
| |
21
|
|
| |
22
|
Netbeans 6.0. http://www.netbeans.com, 2007.
|
| |
23
|
William F. Opdyke and Ralph E. Johnson. Refactoring: An aid in designing application frameworks and evolving object-oriented systems. In Proceedings of Symposium on Object-Oriented Programming Emphasizing Practical Applications (SOOPPA), September 1990.
|
| |
24
|
|
| |
25
|
|
| |
26
|
Semmle. SemmleCode. http://semmle.com, 2008.
|
 |
27
|
|
| |
28
|
The AspectJ Team. The AspectJ Programming Guide.
|
 |
29
|
Frank Tip , Adam Kiezun , Dirk Bäumer, Refactoring for generalization using type constraints, Proceedings of the 18th annual ACM SIGPLAN conference on Object-oriented programing, systems, languages, and applications, October 26-30, 2003, Anaheim, California, USA
|
 |
30
|
Daniel von Dincklage , Amer Diwan, Converting Java classes to use generics, Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, October 24-28, 2004, Vancouver, BC, Canada
|
 |
31
|
|
| |
32
|
w3c. Jigsaw. http://www.w3.org/Jigsaw/, 2006.
|
| |
33
|
David Wheeler. SLOCCount. http://www.dwheeler.com/sloccount/, 2006.
|
|