paperbot · PL 论文追踪

全部论文 待读 收藏

P2 The classification and propagation of program comments

程序注释的分类与传播
ASE Proceedings of the 35th IEEE/ACM International Conference on Automated Software Engineering2020匹配度 3/10 · 该论文属于程序分析/NLP与注释传播的交叉,能检测代码bug和注释缺陷,但与用户核心方向(ML/Agentic程序的静态分析、LLM/Agent改进静态分析或形式化验证、浮点程序分析、贝叶斯程序分析)均无直接关联;且未涉及LLM/Agent或工业级工具落地。引用 0 inbox
Xiangzhe Xu
crossref: 2026-09-12

AI 速览

一句话:提出注释分类与传播方法,利用NLP和语言语义规则在代码实体间传播注释,以检测代码bug和注释缺陷。

自然语言注释是连接人类逻辑与软件语义的桥梁,但代码中常存在注释缺失、错误或不一致。本文对注释进行分类,利用自然语言处理技术提取注释信息,并基于编程语言语义为每类注释构建规则,在代码实体间系统地传播注释。随后用传播得到的注释检查代码使用方式与注释一致性。在真实项目中的原型系统发现37个代码错误,其中30个已被开发者确认;还发现304条缺陷注释,包括12条误导性注释和292条不正确注释。在传播的41573条注释中,87条针对既无代码也无注释的私有native方法。用户研究表明,传播注释在一致性、自然性和意义性三个维度上与人工注释相当。

问题
代码注释与代码语义之间的关联蕴含丰富信息,但注释缺失、错误或与代码不一致会影响开发与维护。
方法
对注释分类并用NLP抽取信息,基于编程语言语义为各类注释设计传播规则,在代码实体间传播注释并检查代码使用与注释一致性。
评估
在真实项目上实现原型系统,统计发现的代码bug和缺陷注释数量,并通过用户研究比较传播注释与人工注释的质量。
原文摘要(Abstract)

Natural language comments are like bridges between human logic and software semantics. Developers use comments to describe the function, implementation, and property of code snippets. This kind of connections contains rich information, like the potential types of a variable and the pre-condition of a method, among other things. In this paper, we categorize comments and use natural language processing techniques to extract information from them. Based on the semantics of programming languages, different rules are built for each comment category to systematically propagate comments among code entities. Then we use the propagated comments to check the code usage and comments consistency. Our demo system finds 37 bugs in real-world projects, 30 of which have been confirmed by the developers. Except for bugs in the code, we also find 304 pieces of defected comments. The 12 of them are misleading and 292 of them are not correct. Moreover, among the 41573 pieces of comments we propagate, 87 comments are for private native methods which had neither code nor comments. We also conduct a user study where we find that propagated comments are as good as human-written comments in three dimensions of consistency, naturalness, and meaningfulness.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot5956,
  title = {The classification and propagation of program comments},
  author = {Xiangzhe Xu},
  booktitle = {ASE},
  year = {2020},
  doi = {10.1145/3324884.3418913}
}