Abstract

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 beforeand 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 sourceand destination-API of the migration respectively. In this paper, we present 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 beforemigration 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, 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 modmes 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 AUTOMIG synthesized a correct patch for 92.2% of the code on average. Our manual investigation on synthesized patches shows that AUTOMIG can synthesize highquality patches that preserve the context of API invocation of each client code.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.