On the Use of Information Retrieval to Automate the Detection of Third-Party Java Library Migration at the Method Level

Hussein Alrubaye,Mohamed Wiem Mkaouer,Ali Ouni
DOI: https://doi.org/10.48550/arXiv.1906.02591
2019-06-02
Abstract:The migration process between different third-party libraries is hard, complex and error-prone. Typically, during a library migration, developers need to find methods in the new library that are most adequate in replacing the old methods of the retired library. This process is subjective and time-consuming as developers need to fully understand the documentation of both libraries Application Programming Interfaces, and find the right matching between their methods if it exists. In this context, several studies rely on mining existing library migrations to provide developers with by-example approaches for similar scenarios. In this paper, we introduce a novel mining approach that extracts existing instances of library method replacements that are manually performed by developers for a given library migration to automatically generate migration patterns in the method level. Thereafter, our approach combines the mined method-change patterns with method-related lexical similarity to accurately detect mappings between replacing/replaced methods. We conduct a large scale empirical study to evaluate our approach on a benchmark of 57,447 open-source Java projects leading to 9 popular library migrations. Our qualitative results indicate that our approach significantly increases the accuracy of mining method-level mappings by an average accuracy of 12%, as well as increasing the number of discovered method mappings, in comparison with existing state-of-the-art studies. Finally, we provide the community with an open source mining tool along with a dataset of all mined migrations at the method level.
Software Engineering
What problem does this paper attempt to address?
The problem that this paper attempts to solve is to automatically detect method - level migrations during the migration of third - party Java libraries. Specifically, when developers are performing library migrations, they need to find the most appropriate corresponding methods in the new library that can replace the removed methods in the old library. This process is usually subjective, time - consuming, and error - prone because developers need to fully understand the application programming interface (API) documents of both libraries and find the correct matches between their methods. Moreover, although existing research has provided some example - based methods to handle similar scenarios, the effectiveness of these methods is limited when dealing with method mappings other than one - to - one, such as one - to - many or many - to - many mappings. To solve these problems, the paper proposes a new mining method. This method automatically generates method - level migration patterns by extracting instances of library method replacements manually performed by developers. Then, this method combines method change patterns with method - related lexical similarity to accurately detect the mapping relationships between replacing/replaced methods. Through this method, the authors hope to improve the accuracy of detecting method - level mappings and increase the number of discovered method mappings. The main contributions of the paper include: 1. Proposing a new method that improves the accuracy of detecting migration fragments during library migrations. 2. Conducting a large - scale empirical study to evaluate the performance of this method in 57,447 open - source Java projects and comparing it with three state - of - the - art methods. 3. Providing an open - source tool and a generated dataset of migration results so that the research community can better understand how developers practice library migrations.