Structurally-Enhanced Approach for Automatic Code Transformation

CAO Ying-Kui,SUN Ze-Yu,ZOU Yan-Zhen,XIE Bing
DOI: https://doi.org/10.21655/ijsi.1673-7288.00263
2021-01-01
International Journal of Software and Informatics
Abstract:In software development, developers often need to change or update lots of similar codes.How to perform code transformation automatically has become a research hotspot in software engineering.An effective way is extracting the modification pattern from a set of similar code changes and applying it to automatic code transformation.In the related work, deep-learning-based approaches have achieved much progress, but they suffer from the problem of significant long-term dependency between the codes.To address this challenge, an automatic code transformation method is proposed, namely ExpTrans.Based on the graphbased representations of code changes, ExpTrans is enhanced with the structural information of code.It labels the dependency between variables in code parsing and adopts the graph convolutional network and Transformer structure to capture the long-term dependency between the code.ExpTrans is first compared with existing learning-based approaches to evaluate its effectiveness; the results show that ExpTrans gains 11.8%-30.8%precision increment.Then, it is compared with rule-based approaches and the results demonstrate that ExpTrans significantly improves the correct rate of the modified instances.
What problem does this paper attempt to address?