Toward an accurate method renaming approach via structural and lexical analyses

Junpeng LUO, Jingxuan ZHANG, Zhiqiu HUANG, Yong XU, Chenxing SUN

PDF(668 KB)
PDF(668 KB)
Front. Inform. Technol. Electron. Eng ›› 2022, Vol. 23 ›› Issue (5) : 732-748. DOI: 10.1631/FITEE.2100470
Orginal Article
Orginal Article

Toward an accurate method renaming approach via structural and lexical analyses

Author information +
History +

Abstract

Methods in programs must be accurately named to facilitate source code analysis and comprehension. With the evolution of software, method names may be inconsistent with their implemented method bodies, leading to inaccurate or buggy method names. Debugging method names remains an important topic in the literature. Although researchers have proposed several approaches to suggest accurate method names once the method bodies have been modified, two main drawbacks remain to be solved: there is no analysis of method name structure, and the programming context information is not captured efficiently. To resolve these drawbacks and suggest more accurate method names, we propose a novel automated approach based on the analysis of the method name structure and lexical analysis with the programming context information. Our approach first leverages deep feature representation to embed method names and method bodies in vectors. Then, it obtains useful verb-tokens from a large method corpus through structural analysis and noun-tokens from method bodies through lexical analysis. Finally, our approach dynamically combines these tokens to form and recommend high-quality and project-specific method names. Experimental results over 2111 Java testing methods show that the proposed approach can achieve a Hit Ratio, or Hit@5, of 33.62% and outperform the state-of-the-art approach by 14.12% in suggesting accurate method names. We also demonstrate the effectiveness of structural and lexical analyses in our approach.

Keywords

Method renaming / Code refactor / Deep learning / Convolutional neural networks

Cite this article

Download citation ▾
Junpeng LUO, Jingxuan ZHANG, Zhiqiu HUANG, Yong XU, Chenxing SUN. Toward an accurate method renaming approach via structural and lexical analyses. Front. Inform. Technol. Electron. Eng, 2022, 23(5): 732‒748 https://doi.org/10.1631/FITEE.2100470

RIGHTS & PERMISSIONS

2022 Zhejiang University Press
PDF(668 KB)

Accesses

Citations

Detail

Sections
Recommended

/