Reusing existing library components is essential for reducing the cost of software development and maintenance. When library components evolve to accommodate new feature requests, to fix bugs, or to meet new standards...
详细信息
Reusing existing library components is essential for reducing the cost of software development and maintenance. When library components evolve to accommodate new feature requests, to fix bugs, or to meet new standards, the clients of software libraries often need to make corresponding changes to correctly use the updated libraries. Existing api usage adaptation techniques support simple adaptation such as replacing the target of calls to a deprecated api, however, cannot handle complex adaptations such as creating a new object to be passed to a different api method, or adding an exception handling logic that surrounds the updated api method calls. This paper presents LIBSYNC that guides developers in adapting apiusage code by learning complex api usage adaptation patterns from other clients that already migrated to a new library version (and also from the apiusages within the library's test code). LIBSYNC uses several graph-based techniques (1) to identify changes to api declarations by comparing two library versions, (2) to extract associated apiusage skeletons before and after library migration, and (3) to compare the extracted apiusage skeletons to recover api usage adaptation patterns. Using the learned adaptation patterns, LIBSYNC recommends the locations and edit operations for adapting apiusages. The evaluation of LIBSYNC on real-world software systems shows that it is highly correct and useful with a precision of 100% and a recall of 91%.
Use of third-party libraries is extremely common in application software. The libraries evolve to accommodate new features or mitigate security vulnerabilities, thereby breaking the Application Programming Interface (...
详细信息
Use of third-party libraries is extremely common in application software. The libraries evolve to accommodate new features or mitigate security vulnerabilities, thereby breaking the Application Programming Interface (api) used by the software. Such breaking changes in the libraries may discourage client code from using the new library versions thereby keeping the application vulnerable and not up-to-date. We propose a novel output-oriented program synthesis algorithm to automate api usage adaptations via program transformation. Our aim is not only to rely on the few example human adaptations of the clients from the old library version to the new library version, since this can lead to over-fitting transformation rules. Instead, we also rely on example usages of the new updated library in clients, which provide valuable context for synthesizing and applying the transformation rules. Our tool apiFIX provides an automated mechanism to transform application code using the old library versions to code using the new library versions - thereby achieving automated api usage adaptation to fix the effect of breaking changes. Our evaluation shows that the transformation rules inferred by apiFIX achieve 98.7% precision and 91.5% recall. By comparing our approach to state-of-the-art program synthesis approaches, we show that our approach significantly reduces over-fitting while synthesizing transformation rules for api usage adaptations.
暂无评论