Two-Stage Patch Synthesis for API Migration from Single API Usage Example
Third-party libraries are widely used and constantly evolving. When migrating client code to a new API, a major challenge is editing client code to adapt to incompatible changes of the API. Some tools provide automated migration that synthesizes a generic patch from migration samples in a pair of before- and after-migration snippets. However, they still have limited applicability due to the difficulty in retrieving an adequate pair in which before- and after-migration snippets invoke the source- and destination-API of the migration respectively.
In this paper, we present textsc{AutoMig}, which addresses the problem by a patch synthesis from a single API usage example that invokes the destination-API. Due to the absence of a before-migration version of the API usage example, it is nontrivial to find out the invariant context of API invocation through the migration. To synthesize a patch that preserves the context in the client code, textsc{AutoMig} synthesizes patches in two-stage patch synthesis procedure. The first stage synthesizes a generic patch to describe a replacement of API. The second stage modifies the generic patch to preserve the context of the API invocation in the client code. Our experiment using a dataset that provides real-world Java codes shows that textsc{AutoMig} synthesized a correct patch for 92.2% of the code on average. Our manual investigation on synthesized patches shows that textsc{AutoMig} can synthesize high-quality patches that preserve the context of API invocation of each client code.
Wed 7 DecDisplayed time zone: Osaka, Sapporo, Tokyo change
14:30 - 15:40 | Migration and VisualizationTechnical Track / SEIP - Software Engineering in Practice / ERA - Early Research Achievements at Room1 Chair(s): Siripen Pongpaichet Mahidol University | ||
14:30 15mPaper | Unified program cross-architecture migration framework model SEIP - Software Engineering in Practice Zhou Minhao Hunan University, Zhe Quan Hunan University, Xin Huang AECC Hunan Aviation powerplant Research Institute | ||
14:45 20mPaper | Two-Stage Patch Synthesis for API Migration from Single API Usage Example Technical Track | ||
15:05 15mPaper | Visualizing Contributor Code Competency for PyPI Libraries: Preliminary Results ERA - Early Research Achievements Indira Febriyanti Universitas Muhammadiyah Surakarta, Raula Gaikovina Kula Nara Institute of Science and Technology, Ruksit Rojpaisarnkit Nara Institute of Science and Technology, Kanchanok Kannee Nara Institute of Science and Technology, Yusuf Sulistyo Nugroho Universitas Muhammadiyah Surakarta, Kenichi Matsumoto Nara Institute of Science and Technology | ||
15:20 15mPaper | Why Visualize Competitive Code? Preliminary Categories for Jupyter Notebooks ERA - Early Research Achievements Tasha Settewong Mahidol University, Natanon Ritta Mahidol University, Raula Gaikovina Kula Nara Institute of Science and Technology, Chaiyong Rakhitwetsagul Mahidol University, Thailand, Thanwadee Sunetnanta Mahidol University, Kenichi Matsumoto Nara Institute of Science and Technology |