NameChecker: Detecting Inconsistency between Method Names and Method Bodies

Kejun Li, Taiming Wang, Hui Liu

科研成果: 书/报告/会议事项章节会议稿件同行评审

摘要

Methods are basic elements for functional organization in software applications. A high-quality method name should clearly express its function, and help developers understand its usages quickly without reading through the lengthy and complex method body. However, in some cases, method names could be inconsistent with their functional implementations. The inconsistency in turn may result in inaccurate interpretation of methods, and even buggy method invocations. To this end, in this paper, we propose a deep learning-based approach, called NameChecker, to detecting the inconsistency between method names and their corresponding method bodies. NameChecker extracts lexical and structural features of source code by static code analysis. Based on the extracted features, NameChecker employs deep learning techniques (i.e., LSTM, and Attention mechanism) to predict whether the given method name is consistent with its implementation. Different from other deep learning based approaches to inconsistency detection, NameChecker avoids the generation (recommendation) of method names. Empirical studies suggested that generated method names are often incorrect, and thus avoiding method name generation may significantly improve the accuracy of NameChecker. We evaluate NameChecker on open-source applications, and our evaluation results suggest that NameChecker improves the state of the art by increasing the F1-score from 66.7% to 73.4%.

源语言英语
主期刊名Proceedings - 2021 28th Asia-Pacific Software Engineering Conference, APSEC 2021
出版商IEEE Computer Society
22-31
页数10
ISBN(电子版)9781665437844
DOI
出版状态已出版 - 2021
活动28th Asia-Pacific Software Engineering Conference, APSEC 2021 - Virtual, Online, 中国台湾
期限: 6 12月 20219 12月 2021

出版系列

姓名Proceedings - Asia-Pacific Software Engineering Conference, APSEC
2021-December
ISSN(印刷版)1530-1362

会议

会议28th Asia-Pacific Software Engineering Conference, APSEC 2021
国家/地区中国台湾
Virtual, Online
时期6/12/219/12/21

指纹

探究 'NameChecker: Detecting Inconsistency between Method Names and Method Bodies' 的科研主题。它们共同构成独一无二的指纹。

引用此