Context-Aware Name Recommendation for Field Renaming
Chunhao Dong, Yanjie Jiang, Nan Niu, Yuxia Zhang, Hui Liu
摘要
Renaming is one of the most popular software refactorings. Although developers may know what the new name should be when they conduct a renaming, it remains valuable for refactoring tools to recommend new names automatically so that developers can simply hit Enter and efficiently accept the recommendation to accomplish the refactoring. Consequently, most IDEs automatically recommend new names for renaming refactorings by default. However, the recommendation made by mainstream IDEs is often incorrect. For example, the precision of IntelliJ IDEA in recommending names for field renamings is as low as 6.3%. To improve the accuracy, in this paper, we propose a context-aware lightweight approach (called CARER) to recommend new names for Java field renamings. Different from mainstream IDEs that rely heavily on initializers and data types of the to-be-renamed fields, CARER exploits both dynamic and static contexts of the renamings as well as naming conventions. We evaluate CARER on 1.1K real-world field renamings discovered from open-source applications. Our evaluation results suggest that CARER can significantly improve the state of the practice in recommending new names for field renamings, improving the precision from 6.30% to 61.15%, and recall from 6.30% to 41.50%. Our evaluation results also suggest that CARER is as efficient as IntelliJ IDEA is, making it suitable to be integrated into IDEs.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
脉络
- Learning to Recommend Method Names with Global Context 引用了 A Context-based Automated Approach for Method Name Consistency Checking and Suggestion
- Learning to Recommend Method Names with Global Context 引用了 Multi-task Learning based Pre-trained Language Model for Code Completion
它引用的 Paper7
- Multi-task Learning based Pre-trained Language Model for Code CompletionFang Liu, Ge Li, Yunfei Zhao, Zhi JinASE 2020 · 162 次引用
- InCoder: A Generative Model for Code Infilling and SynthesisDaniel Fried, Armen Aghajanyan, Jessy Lin, Sida Wang 等ICLR 2023 · 140 次引用
- A Context-based Automated Approach for Method Name Consistency Checking and SuggestionYi Li, Shaohua Wang, Tien N. NguyenICSE 2021 · 36 次引用
- Learning to Recommend Method Names with Global ContextFang Liu, Ge Li, Zhiyi Fu, Shuai Lu 等ICSE 2022 · 32 次引用
- Which abbreviations should be expanded?Yanjie Jiang, Hui Liu, Yuxia Zhang, Nan Niu 等FSE 2021 · 13 次引用
相关 Paper
- An Automated Approach to Extracting Local VariablesXiaye Chi, Hui Liu, Guangjie Li, Weixiao Wang 等FSE 2023 · 8 次引用
- The untold story of code refactoring customizations in practiceDaniel Oliveira, Wesley K. G. Assunção, Alessandro F. Garcia, Ana Carla Bibiano 等ICSE 2023 · 11 次引用
- Cross-Refactoring-Type Test Program Migration for Refactoring EnginesChunhao Dong, Yanjie Jiang, Yang Zhang, Yuxia Zhang 等FSE 2026
- Understanding type changes in JavaAmeya Ketkar, Nikolaos Tsantalis, Danny DigFSE 2020 · 17 次引用
- RefBERT: A Two-Stage Pre-trained Framework for Automatic Rename RefactoringHao Liu, Yanlin Wang, Zhao Wei, Yong Xu 等ISSTA 2023 · 19 次引用
