Passer à la navigation principale Passer à la recherche Passer au contenu principal

AntiCopyPaster 3.0: Just-in-Time Clone Refactoring

  • Eman Abdullah AlOmar
  • , Jacob Ashkenas
  • , Robert Feliciano
  • , Matthew Angelakos
  • , Dimitrios Haralamppopoulos
  • , Xing Qian
  • , Mohamed Wiem Mkaouer
  • , Ali Ouni
  • Stevens Institute of Technology
  • University of Michigan, Flint

Résultats de recherche: Contribution à un journalArticle publié dans une revue, révisé par les pairsRevue par des pairs

Résumé

Refactoring is a crucial practice in software maintenance that aims at improving design and coding practices while addressing design flaws. The Extract Method refactoring is particularly popular for consolidating duplicate code fragments into a single method. Various studies have explored ways to recommend Extract Method refactoring opportunities using techniques such as program slicing, program dependency graph analysis, change history analysis, structural similarity, and feature extraction. Despite their effectiveness, these approaches often disrupt the developer’s workflow, requiring them to pause their coding and assess the refactoring opportunities suggested throughout the project, without considering the specific development context. To enhance the adoption of Extract Method refactoring, our previous work proposed AntiCopyPaster 2.0 and investigated the effectiveness of detecting and extracting code clones without disrupting the developer’s workflow. To address these limitations, we develop a new approach in this article that supports the detection of Type-1 and Type-2 clones using the Program Structure Interface (PSI) and includes a custom-built Extract Method refactoring tool. We implement our approach using an IntelliJ IDEA extension plugin. Additionally, we integrated name recommendation models, including IntelliJ’s built-in recommender and Code2Vec, to enhance the quality of method names and improve developer productivity. To evaluate the accuracy and usefulness of our approach, we conducted a qualitative study involving 13 developers. The results indicate that (1) developers appreciate the approach and are satisfied with various aspects of the plugin’s functionality, (2) PSI effectively identifies clones by analyzing the structural and semantic aspects of the code, (3) IntelliJ’s naming recommender often provides default generic names, while code2vec produces descriptive and relevant names based on the code context, (4) the performance of AntiCopyPaster remains stable regardless of the file size and the number of clones present, (5) despite different detection and correction mechanisms, JDeodorant and AntiCopyPaster were able to perform method extraction, and AntiCopyPaster features just-in-time detection and correction, and (6) our results show an improvement in code quality after performing Extract Method refactoring with both refactoring tools. We envision that our AntiCopyPaster solution can streamline the Extract Method refactoring process, enhancing both developer efficiency and code quality by seamlessly integrating Type-2 clone detection and name recommendation capabilities in the development workflow.

langue originaleAnglais
Numéro d'article132
journalACM Transactions on Software Engineering and Methodology
Volume35
Numéro de publication5
Les DOIs
étatPublié - mai 2026

Empreinte digitale

Voici les principaux termes ou expressions associés à « AntiCopyPaster 3.0: Just-in-Time Clone Refactoring ». Ces libellés thématiques sont générés à partir du titre et du résumé de la publication. Ensemble, ils forment une empreinte digitale unique.

Contient cette citation