In 2017, Google announced Kotlin as an official Android programming language, and more recently, as the preferred programming language to build applications. These facts motivated developers to migrate their applications, which is challenging because each migrated piece of code must be tested after the migration to ensure it preserves the expected behavior. Due to the interoperability between Java and Kotlin, most developers decided to migrate their applications gradually. Thus, developers have to decide which file(s) to migrate first on each migration step. However, there are no tools available to help developers make these choices. This paper presents an approach to support a gradual migration of Android applications that given a version of an application written in Java and eventually, in Kotlin, it suggests the most convenient files to migrate. To this end, we built a large-scale corpus of open-source projects that migrated Java files to Kotlin. Then, we trained a learning to rank model using the information extracted from these projects. To validate our model, we verify whether these recommendations made by them correspond to real migrations. The results showed our approach modestly outperforms random approaches. Since most Android applications are written in Java, we conclude that our approach may significantly impact Android applications' development. Therefore, we consider this result is the first step into long-term research towards a model capable of predicting precisely file-level migration, establishing the initial baseline on file migrations.
翻译:2017年,谷歌宣布Kotlin为官方Android编程语言,最近,谷歌宣布Kotlin为建立应用程序的首选编程语言。这些事实激励开发者将应用程序迁移,这具有挑战性,因为每次迁移的代码必须在迁移后测试,以确保保持预期的行为。由于爪哇和科特林之间的互操作性,大多数开发者决定逐步迁移应用程序。因此,开发者必须决定在每次迁移步骤中首先迁移哪个文件。然而,没有工具可以帮助开发者做出这些选择。本文展示了一种支持安特异应用程序逐步迁移的方法,在爪哇和最终在科特林的应用程序版本中,它提出了最方便迁移的文件。为此,我们建立了一个大型的开放源项目集,将爪哇和科特林的档案迁移到科特林。随后,我们用从这些项目中提取的信息培训了一种排序模型。为了验证我们的模型,我们核查它们提出的这些建议是否与真正的迁移相吻合。结果显示我们的方法略地超越了随机方法。由于大多数安达尔文件应用程序都是在爪哇,我们最初的档案中写成的,因此,我们可以进行长期的预测。