We build a benchmark to evaluate large language models (LLMs) for source code migration tasks, specifically upgrading functions from Java 8 to Java 11. We first collected a dataset of function pairs from open-source repositories, but limitations in data quality led us to construct a refined dataset covering eight categories of deprecated APIs. Using this dataset, the Mistral Codestral model was evaluated with CodeBLEU and keyword-based metrics to measure lexical and semantic similarity as well as migration correctness. Results show that the evaluated model (Mistral Codestral) can handle trivial one-to-one API substitutions with moderate success, achieving identical migrations in 11.11% of the cases, but it struggles with more complex migrations such as CORBA or JAX-WS. These findings suggest Mistral Codestral can partially reduce developer effort by automating repetitive migration tasks but cannot yet replace humans within the scope of the JMigBench benchmark. The benchmark and analysis provide a foundation for future work on expanding datasets, refining prompting strategies, and improving migration performance across different LLMs.
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开发中不可用,并获得更安全的代码(即,避免空指针异常)。我们还确定了研究…
FreshBrew: A Benchmark for Evaluating AI Agents on Java Code Migration
Google(谷歌);Max Planck Institut für Intelligente Systeme (MPI-IS)(马克斯·普朗克智能系统研究所);ELLIS Institute, Tübingen(图宾根ELLIS研究所);Salesforce;Gologic Inc(Gologic公司)
CODEMENV: Benchmarking Large Language Models on Code Migration
Provable Responsible AI and Data Analytics (PRADA) Lab(可证明责任人工智能与数据分析实验室);King Abdullah University of Science and Technology(国王 Abdullah 科学与技术大学);Peking University(北京大学);South China University of Technology(华南理工大学)