Title
HatCUP: Hybrid Analysis and Attention based Just-In-Time Comment Updating
Abstract
When changing code, developers sometimes neglect updating the related comments, bringing inconsistent or outdated comments. These comments increase the cost of program understanding and greatly reduce software maintainability. Researchers have put forward some solutions, such as CUP and HEBCUP, which update comments efficiently for simple code changes (i.e. modifying of a single token), but not good enough for complex ones. In this paper, we propose an approach named HatCUP (Hybrid Analysis and Attention based Comment UPdater), to provide a new mechanism for comment updating task. HatCUP pays attention to hybrid analysis and information. First, HatCUP considers the code structure change information and introduces a structureguided attention mechanism combined with code change graph analysis and optimistic data flow dependency analysis. With a generally popular RNN-based encoder-decoder architecture, HatCUP takes the action of the code edits, the syntax, semantics and structure code changes, and old comments as inputs and generates a structural representation of the changes in the current code snippet. Furthermore, instead of directly generating new comments, HatCUP proposes a new edit or nonedit mechanism to mimic human editing behavior, by generating a sequence of edit actions and constructing a modified RNN model to integrate newly developed components. Evaluation on a popular dataset demonstrates that HatCUP outper-forms the state-of-the-art deep learning-based approaches (CUP) by 53.8% for accuracy, 31.3% for recall and 14.3% for METEOR of the original metrics. Compared with the heuristic-based approach (HEBCUP), HatCUP also shows better overall performance.
Year
DOI
Venue
2022
10.1145/3524610.3527901
2022 IEEE/ACM 30th International Conference on Program Comprehension (ICPC)
Keywords
DocType
ISSN
comment updating,code-comment co-evolution,hybrid analysis,data flow analysis,deep learning
Conference
2643-7147
ISBN
Citations 
PageRank 
978-1-6654-5209-0
0
0.34
References 
Authors
21
3
Name
Order
Citations
PageRank
Hongquan Zhu100.34
Xincheng He201.69
Lei Xu300.34