One of the costs of reusing software components is updating applications to use the new version of the components. Updating an application can be error-prone, tedious, and disruptive of the development process. Our previous study showed that more than 80% of the disruptive changes in five different components were caused by refactorings. If the refactorings that happened between two versions of a component could be automatically detected, a refactoring tool could replay them on applications. We present an algorithm that detects refactorings performed during component evolution. Our algorithm uses a combination of a fast syntactic analysis to detect refactoring candidates and a more expensive semantic analysis to refine the results. The experiments on components ranging from 17 KLOC to 352 KLOC show that our algorithm detects refactorings in real-world components with accuracy over 85%.
Current work on automatic detection of refactorings typically assumes a closed-world, i.e., codebases used only in-house. Changes in closed-world happen abruptly, and refactorings are easier to spot. Libraries and frameworks are developed to be reused outside the organization and therefore the changes do not happen overnight but follow a long deprecate-replace-remove cycle. Obsolete entities will coexist with their newer counterparts until they are no longer supported. This lifecycle introduces enough noise that current tools cannot accurately detect the refactorings. We propose a methodology and a tool that fits with an open-world paradigm. We use a Shingles algorithm to detect clones of the same entity and then refine the results with semantic analysis. Preliminary evaluation shows that our method scales for real-life libraries and can accurately detect when entities are renamed or moved.