Code comments are valuable for program comprehension and software maintenance, and also require maintenance with code evolution. However, when changing code, developers sometimes neglect updating the related comments, bringing in inconsistent or obsolete comments (aka., bad comments). Such comments are detrimental since they may mislead developers and lead to future bugs. Therefore, it is necessary to fix and avoid bad comments. In this work, we argue that bad comments can be reduced and even avoided by automatically performing comment updates with code changes. We refer to this task as “Just-In-Time (JIT) Comment Updating” and propose an approach named CUP (Comment UPdater) to automate this task. CUP can be used to assist developers in updating comments during code changes and can consequently help avoid the introduction of bad comments. Specifically, CUP leverages a novel neural sequence-to-sequence model to learn comment update patterns from extant code-comment co-changes and can automatically generate a new comment based on its corresponding old comment and code change. Several customized enhancements, such as a special tokenizer and a novel co-attention mechanism, are introduced in CUP by us to handle the characteristics of this task. We build a dataset with over 108K comment-code co-change samples and evaluate CUP on it. The evaluation results show that CUP outperforms an information-retrieval-based and a rule-based baselines by substantial margins, and can reduce developers’ edits required for JIT comment updating. In addition, the comments generated by our approach are identical to those updated by developers in 1612 (16.7%) test samples, 7 times more than the best-performing baseline.
Wed 23 SepDisplayed time zone: (UTC) Coordinated Universal Time change
09:10 - 10:10 | AI for Software Engineering (3)Research Papers at Wombat Chair(s): Artur Andrzejak Heidelberg University | ||
09:10 20mTalk | Automatic Extraction of Cause-Effect-Relations from Requirements Artifacts Research Papers Julian Frattini Blekinge Institute of Technology, Maximilian Junker Technische Universität Muenchen, Michael Unterkalmsteiner Blekinge Institute of Technology, Daniel Mendez Blekinge Institute of Technology | ||
09:30 20mTalk | BiLO-CPDP: Bi-Level Programming for Automated Model Discovery in Cross-Project Defect Prediction Research Papers Ke Li University of Exeter, Zilin Xiang University of Electronic Science and Technology of China, Tao Chen Loughborough University, Kay Chen Tan City University of Hong Kong Pre-print | ||
09:50 20mTalk | Automating Just-In-Time Comment Updating Research Papers Zhongxin Liu Zhejiang University, Xin Xia Monash University, Meng Yan Chongqing University, Shanping Li Zhejiang University Pre-print |