Affiliation:
1. Department of Computer Science, City University of Hong Kong, Hong Kong, China
2. School of Computer Science and Artificial Intelligence, Wuhan University of Technology, and Software Engineering Application Technology Lab, Huawei, Wuhan, Hubei, China
3. School of Computing, National University of Singapore, Singapore
4. Key Laboratory of High Confidence Software Technologies, Ministry of Education, and School of Computer Science, Peking University, Beijing, China
Abstract
Software comments sometimes are not promptly updated in sync when the associated code is changed. The inconsistency between code and comments may mislead the developers and result in future bugs. Thus, studies concerning code-comment synchronization have become highly important, which aims to automatically synchronize comments with code changes. Existing code-comment synchronization approaches mainly contain two types, i.e., (1) deep learning-based (e.g., CUP), and (2) heuristic-based (e.g., HebCUP). The former constructs a neural machine translation-structured semantic model, which has a more generalized capability on synchronizing comments with software evolution and growth. However, the latter designs a series of rules for performing token-level replacements on old comments, which can generate the completely correct comments for the samples fully covered by their fine-designed heuristic rules. In this article, we propose a composite approach named
CBS
(i.e.,
Classifying Before Synchronizing
) to further improve the code-comment synchronization performance, which combines the advantages of CUP and HebCUP with the assistance of inferred categories of
Code-Comment Inconsistent (CCI)
samples. Specifically, we firstly define two categories (i.e., heuristic-prone and non-heuristic-prone) for CCI samples and propose five features to assist category prediction. The samples whose comments can be correctly synchronized by HebCUP are heuristic-prone, while others are non-heuristic-prone. Then, CBS employs our proposed
Multi-Subsets Ensemble Learning (MSEL)
classification algorithm to alleviate the class imbalance problem and construct the category prediction model. Next, CBS uses the trained MSEL to predict the category of the new sample. If the predicted category is heuristic-prone, CBS employs HebCUP to conduct the code-comment synchronization for the sample, otherwise, CBS allocates CUP to handle it. Our extensive experiments demonstrate that CBS statistically significantly outperforms CUP and HebCUP, and obtains an average improvement of 23.47%, 22.84%, 3.04%, 3.04%, 1.64%, and 19.39% in terms of Accuracy, Recall@5,
Average Edit Distance (AED)
,
Relative Edit Distance (RED)
, BLEU-4, and
Effective Synchronized Sample (ESS)
ratio, respectively, which highlights that category prediction for CCI samples can boost the code-comment synchronization performance.
Funder
General Research Fund
Research Grants Council of Hong Kong
City University of Hong Kong
National Natural Science Foundation of China
Singapore National Research Foundation and National University of Singapore
National Satellite of Excellence in Trustworthy Software Systems
Trustworthy Software Systems Core Technologies Grant
The Natural Science Foundation of Chongqing City
Publisher
Association for Computing Machinery (ACM)
Reference100 articles.
1. 2018. A Commit in Apache Wicket. https://github.com/apache/wicket/pull/283/commits/8dcf2e34927e0c164235f5bea79c7026d22192dc. (Accessed on 02/24/2022).
2. 2019. A Commit in Google Nomulus. https://github.com/google/nomulus/commit/cf507dad6d7bfc9e30eb520da0c08a75d054b2bd. (Accessed on 02/24/2022).
3. 2022. apache/hive: Apache Hive. https://github.com/apache/hive. (Accessed on 02/25/2022).
4. 2022. Difflib – Helpers for Computing Deltas – Python 3.10.2 Documentation. https://docs.python.org/3/library/difflib.html. (Accessed on 03/07/2022).
5. 2022. Facebook/fresco: An Android Library for Managing Images and the Memory They Use. https://github.com/facebook/fresco. (Accessed on 02/25/2022).
Cited by
17 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献