Context: During the last years, developers of mobile applications have the possibility to use new paradigms and tools for developing mobile applications. For instance, since 2017 Android developers have the official support to write Android applications using Kotlin language. Kotlin is programming language fully interoperable with Java that combines object-oriented and functional features. Objective: The goal of this paper is twofold. First, it aims to study the degree of adoption of Kotlin language on development of open-source Android applications and to measure the amount of Kotlin code inside Android applications. Secondly, it aims to measure the quality of Android applications that are written using Kotlin and to compare it with the quality of Android applications written using Java. Method: We first defined a method to detect Kotlin applications from a dataset of open-source Android applications. Then, we analyzed those applications to detect instances of code smells and computed an estimation of quality of the applications. Finally, we studied how the introduction of Kotlin code impacts on the quality of an Android application. Results: Our experiment found that 11.26% of applications from a dataset with 2,167 open-source applications have been written (partially or fully) using Kotlin language. We found that the introduction of Kotlin code increases the quality (in terms of presence of code smells) of the majority of the Android applications initially written in Java.
Why did developers migrate Android applications from Java to Kotlin?
目前,大多数在移动设备上运行的应用程序都是用Java开发的Android应用程序。然而,开发人员现在可以使用一种新的程序设计语言编写Android应用程序:Kotlin,谷歌在2017年将其作为开发Android应用程序的官方程序设计语言。从那时起,Android开发人员已经能够:a)使用Kotlin从头开始编写Android应用程序,b)通过添加Kotlin代码(可能归功于两种语言之间的互操作性)来改进现有的Java Android应用程序,或者c)将其Android应用程序从Java迁移到Kotlin。本文旨在研究这最后一种情况。我们进行了一项定性研究,以了解Android开发人员将Java代码迁移到Kotlin的原因,并将他们在此过程中的经验汇总在一起,以确定他们面临的主要困难。为了执行这项研究,我们首先确定了来自开源Android项目的提交,这些项目已经将Java代码迁移到Kotlin。然后,我们给编写这些迁移的开发人员发了电子邮件。因此,我们从98名将代码从Java迁移到Kotlin的开发人员那里获得了信息。本文介绍了研究确定的进行迁移的主要原因。我们发现开发人员将Java代码迁移到Kotlin是为了访问程序设计语言功能(例如,扩展函数,扩展函数,智能转换),这些功能在Java for Android开发中不可用,并获得更安全的代码(即,避免空指针异常)。我们还确定了研究…
An Empirical Study of Kotlin-Java Cross-Dependency Issues and Their Detection
Nanjing University of Science and Technology, China(南京理工大学);Huawei Technologies Co., Ltd.(华为技术有限公司);School of Computer Science, Wuhan University, China(武汉大学计算机学院)
Diagnosing and Resolving Android Applications Building Issues: An Empirical Study
University of Cincinnati(辛辛那提大学);California State University, Long Beach(加州州立大学长滩分校);University of Central Missouri(中密苏里大学);The University of Arizona(亚利桑那大学)
Negative Results of Fusing Code and Documentation for Learning to Accurately Identify Sensitive Source and Sink Methods An Application to the Android Framework for Data Leak Detection