AUGraft: Graft New API Usage into Old Code

Kai Wang,Ping Yu
DOI: https://doi.org/10.1145/3545258.3545279
2022-01-01
Abstract:Software libraries are essential in software development process. When a library evolves, client applications that rely on the library APIs are supposed to migrate their code to utilize new or updated features. Code migration is a challenging task, as developers need to spend time and effort searching for and understanding alternate API usage. Some tools collected code migration instances by mining software repositories and guided old code to evolve according to heuristic migration rules. Most of them focused on statement level modification and relied on a high degree of matching between deprecated API usage and migration instances, thus the applicable scenarios were limited. We propose a new approach, AUGraft, which automatically grafts new API usage into old code by matching and editing fine-grained abstract syntax tree elements. By searching 1,881 projects on FDroid, AUGraft collected 442 unique migration instances with Android SDK, of which 418 are correct. We applied AUGraft on 15 projects and got 367 migration results, of which 294 usages are useful, and 225 usages in them are migrated perfectly. We demonstrate AUGraft can improve the utilization of migration instances with high code migration accuracy.
What problem does this paper attempt to address?