paper

An Empirical Study of Kotlin-Java Cross-Dependency Issues and Their Detection

arXiv:2405.04602

Abstract

Since Google introduced Kotlin as an official programming language for developing Android apps in 2017, Kotlin has gained widespread adoption in Android development. The interoperability of Java and Kotlin's design nature allows them to coexist and interact with each other smoothly within a project. However, there is limited research on how Java and Kotlin interact with each other in real-world projects and what challenges are faced during these interactions. The answers to these questions are key to understanding these kinds of cross-language software systems. In this paper, we implemented a tool; named DependExtractor, which can extract 11 types and 9 types of Kotlin-Java and Java-Kotlin dependencies, and conducted an empirical study of 40 Kotlin-Java real-world projects with 27,427 Java and 36,141 Kotlin source files. Our findings revealed that Java and Kotlin frequently interact with each other in these cross-language projects, with Access and Call dependency types being the most dominant. Compared to files interacting with other files in the same language, Java/Kotlin source files, which participate in the cross-language interactions, experience more commits and exhibit a higher defect rate. Additionally, among all Kotlin-Java problematic interactions, we identified ten common issues, along with their fixing strategies. Furthermore, we implemented a tool called InteropScan to proactively detect these issues from Java and Kotlin source code. The findings of this study can help developers understand and address the challenges in Kotlin-Java projects.

Preprint accepted for publication in IEEE Transactions on Software Engineering (TSE) 2026, which is an extension of our previous work "Cross-Language Dependencies: An Empirical Study of Kotlin-Java" (https://arxiv.org/abs/2405.04602) published at ESEM 2024