paperbot · PL 论文追踪

全部论文 待读 收藏

P2 CPC

CPC:程序分析驱动的代码注释传播与分类
ICSE Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering2020匹配度 3/10 · 论文属于程序分析与开发者工具,用程序分析传播注释辅助缺陷检测,但未涉及 LLM/Agent、浮点程序分析或贝叶斯程序分析,与画像核心交叉方向关联较弱。引用 41 inbox
Juan Zhai, Xiangzhe Xu, Yu Shi, Guanhong Tao, Minxue Pan, Shiqing Ma, Lei Xu, Weifeng Zhang, Lin Tan, Xiangyu Zhang
crossref: 2026-09-12

AI 速览

一句话:提出 CPC,用程序分析系统化推导、精炼并传播代码注释,辅助缺陷检测。

代码注释有助于缺陷检测、规约推断和代码合成,但开发者常不愿编写和更新注释,直接利用注释不可行且易错。本文提出用程序分析系统化地推导、精炼和传播注释,并建立细粒度注释分类体系与自动分类器。作者实现原型 CPC,在 5 个项目上评估:以 88% 准确率从其他代码位置传播得到 41573 条新注释,为 87 个无注释且无源码的 native 方法生成功能注释;据此发现开源大型项目中 37 个新缺陷(30 个被确认修复),以及现有注释中 304 个缺陷(12 条不完整、292 条错误)。用户研究显示传播注释质量与已有注释相当。

问题
代码注释对多种软件工程任务很有价值,但开发者缺乏动力编写和更新注释,导致直接依赖注释不可靠。
方法
本文构建细粒度注释分类体系与自动分类器,并利用程序分析系统化地推导、精炼和传播注释,实现原型 CPC。
评估
在 5 个项目上评估,传播得到 41573 条新注释(88% 准确率),检测 37 个新 bug(30 个已确认修复)和 304 个注释缺陷,并通过用户研究验证注释质量。
原文摘要(Abstract)

Code comments provide abundant information that have been leveraged to help perform various software engineering tasks, such as bug detection, specification inference, and code synthesis. However, developers are less motivated to write and update comments, making it infeasible and error-prone to leverage comments to facilitate software engineering tasks. In this paper, we propose to leverage program analysis to systematically derive, refine, and propagate comments. For example, by propagation via program analysis, comments can be passed on to code entities that are not commented such that code bugs can be detected leveraging the propagated comments. Developers usually comment on different aspects of code elements like methods, and use comments to describe various contents, such as functionalities and properties. To more effectively utilize comments, a fine-grained and elaborated taxonomy of comments and a reliable classifier to automatically categorize a comment are needed. In this paper, we build a comprehensive taxonomy and propose using program analysis to propagate comments. We develop a prototype CPC, and evaluate it on 5 projects. The evaluation results demonstrate 41573 new comments can be derived by propagation from other code locations with 88% accuracy. Among them, we can derive precise functional comments for 87 native methods that have neither existing comments nor source code. Leveraging the propagated comments, we detect 37 new bugs in open source large projects, 30 of which have been confirmed and fixed by developers, and 304 defects in existing comments (by looking at inconsistencies between existing and propagated comments), including 12 incomplete comments and 292 wrong comments. This demonstrates the effectiveness of our approach. Our user study confirms propagated comments align well with existing comments in terms of quality.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot5578,
  title = {CPC},
  author = {Juan Zhai and Xiangzhe Xu and Yu Shi and Guanhong Tao and Minxue Pan and Shiqing Ma and Lei Xu and Weifeng Zhang and Lin Tan and Xiangyu Zhang},
  booktitle = {ICSE},
  year = {2020},
  doi = {10.1145/3377811.3380427}
}