A language generic solution for name binding preservation in refactorings

The implementation of refactorings for new languages requires considerable effort from the language developer. We aim at reducing that effort by using language generic techniques. This paper focuses on behavior preservation, in particular the preservation of static name bindings. To detect name binding violations, we implement a technique that reuses the name analysis defined in the compiler front end. Some languages offer the possibility to access variables using qualified names. As a refinement to violation detection, we show that name analysis can be defined as a reusable traversal strategy that can be applied to restore name bindings by creating qualified names. These techniques offer an efficient and reliable solution; the semantics of the language is implemented only once, with the compiler being the single source of truth. We evaluate our approach by implementing a language generic rename refactoring, which we apply to two domain specific languages and a subset of the Java language.

[1]  James Hook,et al.  An Overview of the Programatica Toolset , 2004 .

[2]  Eelco Visser,et al.  Declaratively programming the mobile web with Mobl , 2011, OOPSLA '11.

[3]  P. Klint,et al.  Efficient annotated terms , 2000 .

[4]  Martin Fowler,et al.  Refactoring - Improving the Design of Existing Code , 1999, Addison Wesley object technology series.

[5]  Darko Marinov,et al.  Automated testing of refactoring engines , 2007, ESEC-FSE '07.

[6]  Torbjörn Ekman,et al.  The jastadd extensible java compiler , 2007, OOPSLA.

[7]  Torbjörn Ekman,et al.  Refactoring is not (yet) about transformation , 2008, WRT '08.

[8]  Eelco Visser,et al.  Stratego/XT 0.17. A language and toolset for program transformation , 2008, Sci. Comput. Program..

[9]  Jose Meseguer,et al.  Formal Specification and Verification of Java Refactorings , 2006, 2006 Sixth IEEE International Workshop on Source Code Analysis and Manipulation.

[10]  Torbjörn Ekman,et al.  Sound and extensible renaming for java , 2008, OOPSLA.

[11]  Ralf Lämmel,et al.  Towards generic refactoring , 2002, RULE '02.

[12]  Huiqing Li,et al.  Tool support for refactoring functional programs , 2003, PEPM '08.

[13]  Görel Hedin,et al.  Reference Attributed Grammars , 2000, Informatica.

[14]  William F. Opdyke,et al.  Refactoring object-oriented frameworks , 1992 .

[15]  Eelco Visser,et al.  Code Generation by Model Transformation , 2008, ICMT@TOOLS.

[16]  Rohit Gheyi,et al.  Making Program Refactoring Safer , 2010, IEEE Software.

[17]  Eelco Visser,et al.  Syntax definition for language prototyping , 1997 .

[18]  Bernhard Rumpe,et al.  MontiCore: Modular Development of Textual Domain Specific Languages , 2008, TOOLS.

[19]  Don Roberts,et al.  Practical analysis for refactoring , 1999 .

[20]  Ralf Lämmel,et al.  A Strafunski Application Letter , 2003, PADL.

[21]  Pierre-Etienne Moreau,et al.  Tom: Piggybacking Rewriting on Java , 2007, RTA.

[22]  Mirko Seifert,et al.  Derivation and Refinement of Textual Syntax for Models , 2009, ECMDA-FA.

[23]  Eelco Visser,et al.  The spoofax language workbench: rules for declarative specification of languages and IDEs , 2010, OOPSLA.