For a quick introduction, there is a teaser video available:
Update: For a brief overview, you might also want to take a look at our poster about RefaFlex.
RefaFlex is a refactoring engine to refactor reflective Java programs. RefaFlex logs reflective calls during test runs and then uses this information to proactively prevent the programmer from executing refactorings that could otherwise alter the program’s behaviour. RefaFlex can be used to extend most refactoring tool for Java in order to make them reflection safe. As a proof of concept, we extended six of the JDT refactoring tools:
RefaFlex builds on TamiFlex and Refacola. While we used TamiFlex to collect reflection data, the RefaCola is used to express the constraint rules the refactrings have to obey.
Current refactoring tools for modern IDEs do not offer support for reflection, resulting in changed program semantics when refactoring reflective code. RefaFlex aids in this demand by collecting runtime information from previous test runs and providing a constraint generator giving the programmer valuable information where a refactoring may change a program’s behaviour past refactoring.
This successfully helps to prevent refactorings breaking program behaviour. But there is even more, RefaFlax can do! When renaming a declaration, RefaFlex offers to reflect that rename in the source code to make the given test suites still run past the refactoring.
When moving a declaration, it might get inaccessible for a reflective invocation such that an IllegalAccessException is imminent. RefaFlex can also offer appropriate program transformations for this case.
Our implementation actually disregards some corner cases that might occur in context of reflection and refactoring.
We offer for download:
You may install TamiFlex and RefaFlex by just copying the plugins into your Eclipse’s plugin folder. RefaFlex contributes a page to the Eclipse preferences where you can specify where to look for a TamiFlex log and which refactoring tools to extend. Alike, you may choose whether you like TamiFlex to only add warnings to refactoring dialogs or also like it to contribute code transformations as shown above.
Automatic test runs can be started using the class de.feu.ps.refacola.lang.reflectjava2.rtt.ReflectionRTT. Here, you might want to set additional parameters (e.g., which refactoring tool to test). The ReflectionRTT can also be started using the UI by selecting "Refactoring Tool Test" in the context menu of a Java project.