Aspect Refactoring Tools
The goal of the Aspect Refactoring Tools project is to create a framework for better refactoring tools, in particular supporting aspect-oriented features as in AspectJ.
Aspect-oriented programming allows the clean modularisation of crosscutting concerns. On a static level, this is achieved by inter-type declarations, which can declare members (fields, methods, and constructors) that are owned by other types. The presence of such declarations clearly has a pronounced impact on name lookup, and poses a significant challenge even to conceptually very simple refactorings such as renaming. We have developed a systematic and extensible implementation of renaming for Java 5 with inter-type declarations as an extension of the JastAddJ Java compiler.
Existing refactoring engines in popular Java IDEs such as IntelliJ or Eclipse do not support refactoring with inter-type declarations, and even for pure Java programs they fail to handle many corner cases. Our renaming implementation corresponds closely to the compiler's name lookup implementation and handles all these cases correctly and is not significantly slower than its industrial strength counterparts, even on very large input programs.
To verify the correctness of our refactoring implementation, we have implemented the core of a rename refactoring for a subset of Java in Coq and proved its correctness. The techniques developed for this purpose turn out to be generally applicable for formalising reference attribute grammars.
Future work on the project will further address issues of correctness and performance of refactorings, as well as implementing refactorings that deal with the dynamic side of aspect-oriented programming, i.e. pointcuts and advice.
Resources
Max Schäfer, Torbjörn Ekman, Oege de Moor. Sound and Extensible Renaming for Java. Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2008. The accompanying implementation is available here.
Contacts
Oege de Moor, Mathieu Verbaere, Torbjörn Ekman, and Max Schaefer