Transforming Code with Compositional Mappings for API-Library Switching.

Ling Wu,Qian Wu,Guangtai Liang,Qianxiang Wang,Zhi Jin
DOI: https://doi.org/10.1109/compsac.2015.29
2015-01-01
Abstract:API-library switching is to change an underlying API library to another one for a given program. API-library switching is frequent in software-development process, with typical examples as migrating programs across platforms or across incompatible versions of API libraries. Manual API-library switching is time-consuming and error-prone. To address this problem, previous research has proposed a series of rule based code-transformation approaches. However, these existing approaches are ineffective in conducting code transformation for those original code snippets containing a sequence of method invocations correlated with each other and in need of being considered together when transformed. We call the pair of an original code snippet and its transformed target code snippet as a compositional-mapping instance. Through our empirical investigation, we confirm that compositional-mapping instances widely exist during API-library switching. To handle compositional-mapping instances, in this paper, we propose a novel code-transformation approach named as CMIT. Our evaluations compare CMIT with an existing rule-based code transformation approach. The evaluation results show that, compared to the existing approach, CMIT is more flexible, and CMIT increases the recall on average by 33.8% without decreasing the precision.
What problem does this paper attempt to address?