Software developers commonly use third-party software libraries to reduce implementation efforts and mitigate errors in their source code while building high-quality and reliable software. To support software evolution, newer libraries are released periodically with added features, improvements in performance as well as critical updates such as bug fixes. Hence, older, existing (source) libraries need to be replaced with their newer, updated (target) counterparts, in a process known as library migration. Typically, library migration is a time-consuming, manual, and error-prone process that requires developers to analyze the source and target library code and its documentation. Specifically, developers examine Application Programming Interface (API) implementations and documentation to replace each source API with a target API without modifying the underlying software functionality. While recent works have used various techniques to recommend suitable target library replacements, these approaches do not generalize well, e.g., when a source library method needs to be replaced by one or more target library APIs or methods. To address this limitation, we propose the use of multi-objective evolutionary algorithms to identify suitable method replacements during library migration. In particular, we formulate library migration at the method-level as a multi-objective combinatorial optimization problem and examine the performance of 7 multi-objective evolutionary algorithms: UNSGAIII, RNSGAII, AGEMOEA, SMSEMOA, NSGAII, IBEA and MOEAD. We use method signature and documentation similarity, and co-occurrence probability to accurately recommend one or more target library methods. We evaluate our approach by conducting an empirical study on 9 popular Java library migrations mined from 57,447 open-source projects on GitHub. Our results demonstrate that UNSGAIII, RNSGAII, AGEMOEA, SMSEMOA, NSGAII, IBEA and MOEAD achieve 90%, 89%, 94%, 90%, 91%, 94%, and 71% precision on average, and 83%, 23%, 58%, 63%, 58%, 60% and 17% average recall respectively. In the interest of reproducibility, we make all code and results publicly available at: http://bit.ly/MOO-api-migration.
Read full abstract