arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.04602cs.SE
收藏

Kotlin-Java跨依赖问题及其检测的实证研究

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(武汉大学计算机学院)

Qiong Feng, Xiaotian Ma, Jiayi Sheng, Huan Ji, Peng Liang

AI总结:

本文通过DependExtractor工具对40个Kotlin-Java项目开展实证研究,明确了跨语言依赖特征,识别出10类问题及修复策略,并实现InteropScan工具用于检测问题,为开发者提供帮助。

摘要:

自2017年谷歌将Kotlin作为开发安卓应用的官方编程语言以来,Kotlin在安卓开发中得到广泛采用。Java与Kotlin的互操作性设计使二者可在项目内平稳共存与交互,但针对真实项目中Java与Kotlin的交互方式及交互过程中面临的挑战,现有研究有限,这些问题的答案是理解此类跨语言软件系统的关键。本文实现了名为DependExtractor的工具,可提取Kotlin到Java的11种依赖类型及Java到Kotlin的9种依赖类型,并对40个包含27427个Java源文件和36141个Kotlin源文件的真实Kotlin-Java项目开展实证研究。研究发现,Java与Kotlin在这些跨语言项目中频繁交互,其中访问依赖与调用依赖类型占比最高;与同语言内交互的文件相比,参与跨语言交互的Java/Kotlin源文件提交次数更多,缺陷率更高。此外,在所有Kotlin-Jotlin有问题的交互中,研究人员识别出10种常见问题及对应的修复策略,还实现了名为InteropScan的工具,可主动从Java和Kotlin源代码中检测这些问题。本研究的发现可帮助开发者理解并解决Kotlin-Java项目中的相关挑战。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑