Boosting Identifier Renaming Opportunity Identification via Context-Based Deep Code Representation

Jingxuan Zhang, Zhuhang Li, Jiahui Liang, Zhiqiu Huang · IEEE Transactions on Reliability · 2025

Source code refactoring brings many benefits to the software being developed, e.g., reduces the likelihood of future development failures and simplifies the implementation of new features. Among the various code refactoring activities, identifier renaming is one of the most frequent software development activities conducted by developers, which plays an important role in program analysis and understanding. However, manually detecting identifier renaming opportunities is time-consuming and labor-intensive. Recently, researchers have proposed several automatic renaming opportunity identification approaches for identifiers. However, existing approaches only focus on one or several specific types of identifiers without generally considering all the types of identifiers. To resolve this problem, we put forward a new approach to detect identifier renaming opportunities by fully exploiting the changes of the programming context and the related code entities. Specifically, we first utilize a siamese network, which employs different attention headers to incorporate the programming context and the related code entities, to derive the semantically meaningful embeddings of identifiers. We then utilize these vectors to train a classifier, which can be used for predicting renaming opportunities for identifiers. Experimental results on 29 255 identifiers from ten Java projects in the Apache community demonstrate that our approach outperforms the state-of-the-art baseline approach by 11.97% as for the average F-Measure in identifying renaming opportunities for all the types of identifiers. In addition, we also verified the effectiveness of some key components of our approach. For instance, utilizing the related code entities into our approach improves the average F-Measure by 6.60%.

Read the paper · More papers on PaperTik