Abstract
With the popularity of code search, it is an important problem how to make the retrieved source code change automatically based on the user needs. However, none of the existing code transformation methods could solve this problem. They either fix compile bugs or depend on the formal specifications which lack the practicality. In this paper, we propose a novel generative transformation based on code change: we generate the abstract change script from code changes and apply the script to transform the retrieved source code. To evaluate our method, we extract 7 topics and collect 5–6 code snippets per topic from Github, and perform 5 different experiments in which we even explore 2 sensitivity-related rules and use the rules for raising the accuracy gradually. The experimental results show that our method is feasible and practical with 73.84% accuracy.
Get full access to this article
View all access options for this article.
