paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Suggesting natural method names to check name consistencies

建议自然的方法名以检查名称一致性
ICSE Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering2020匹配度 3/10 · 该论文用传统机器学习做方法名生成与一致性检查,属于机器学习与程序语言/软件工程的交叉,但未涉及用户核心关注的 LLM/Agent、ML 系统静态分析、浮点程序分析或贝叶斯程序分析,且并非基于当前强 LLM 的工具增强静态分析。引用 65 inbox
Son Nguyen, Hung Phan, Trinh Le, Tien N. Nguyen
crossref: 2026-09-12

AI 速览

一句话:提出 MNire,用机器学习从方法体、接口和类名生成候选方法名,以检查名称与实现是否一致。

方法或 API 名称具有误导性会让开发者误解功能与用法,导致 API 误用和缺陷。MNire 用机器学习检查方法名与实现是否一致:先生成候选名,再与原名比较,足够相似即认为一致。其依据来自大规模方法名实证研究:方法名的许多 token 可从方法体、接口(参数与返回类型)和所在类名三个上下文中找到;即使未直接出现,也可利用上下文因高共现概率进行预测。核心思想是把名称生成视为对这三类上下文中程序实体名称 token 的抽象摘要。

问题
方法或 API 名称的误导会使开发者误解程序功能与 API 用法,进而导致 API 误用和缺陷;核心问题是自动检查给定方法名与其实现是否一致。
方法
MNire 通过机器学习生成候选方法名并与当前名称比较,若足够相似则判定一致;生成时利用方法体、接口和所在类名三个上下文,将名称生成视为对相关程序实体名称 token 的抽象摘要。
评估
基于大规模方法名数据集开展实证研究,验证方法名 token 在三类上下文中的分布与共现规律,并据此构建候选名生成与相似度比较机制;摘要未报告具体准确率等指标。
原文摘要(Abstract)

Misleading names of the methods in a project or the APIs in a software library confuse developers about program functionality and API usages, leading to API misuses and defects. In this paper, we introduce MNire, a machine learning approach to check the consistency between the name of a given method and its implementation. MNire first generates a candidate name and compares the current name against it. If the two names are sufficiently similar, we consider the method as consistent. To generate the method name, we draw our ideas and intuition from an empirical study on the nature of method names in a large dataset. Our key finding is that high proportions of the tokens of method names can be found in the three contexts of a given method including its body, the interface (the method's parameter types and return type), and the enclosing class' name. Even when such tokens are not there, MNire uses the contexts to predict the tokens due to the high likelihoods of their co-occurrences. Our unique idea is to treat the name generation as an abstract summarization on the tokens collected from the names of the program entities in the three above contexts.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot5668,
  title = {Suggesting natural method names to check name consistencies},
  author = {Son Nguyen and Hung Phan and Trinh Le and Tien N. Nguyen},
  booktitle = {ICSE},
  year = {2020},
  doi = {10.1145/3377811.3380926}
}