Refactoring Detection in C++ Programs with RefactoringMiner++
Benjamin Ritz, Aleksandar Karakaš, Denis Helic
TL;DR
Refactoring plays a critical role in software evolution, yet distinguishing refactorings from behavior-altering changes is challenging in practice. The authors introduce RefactoringMiner++, the first publicly available C++ refactoring detector built by extending the state-of-the-art Java tool RefactoringMiner 3, and add the capability to report behavior-altering changes. The design leverages libClang to build AST-based models of C++ programs, translates C++ constructs into RefactoringMiner-compatible models, and serializes data to JSON for cross-language analysis. Evaluation uses LLM-generated seed datasets to compare RefactoringMiner++ with its Java counterpart, showing equivalent detection for simple C++ refactorings, while outlining clear limitations and a roadmap for broader, real-world validation and feature expansion.
Abstract
Commits often involve refactorings -- behavior-preserving code modifications aiming at software design improvements. Refactoring operations pose a challenge to code reviewers, as distinguishing them from behavior-altering changes is often not a trivial task. Accordingly, research on automated refactoring detection tools has flourished over the past two decades, however, the majority of suggested tools is limited to Java projects. In this work, we present RefactoringMiner++, a refactoring detection tool based on the current state of the art: RefactoringMiner 3. While the latter focuses exclusively on Java, our tool is -- to the best of our knowledge -- the first publicly available refactoring detection tool for C++ projects. RefactoringMiner's thorough evaluation provides confidence in our tool's performance. In addition, we test RefactoringMiner++ on a small seeded dataset and demonstrate the tool's capability in a short demo involving both refactorings and behavior-altering changes. A screencast demonstrating our tool can be found at https://cloud.tugraz.at/index.php/s/oCzmjfFSaBxNZoe.
