JMigBench: A Benchmark for Evaluating LLMs on Source Code Migration (Java 8 to Java 11)
Nishil Amin, Zhiwei Fei, Xiang Li, Justyna Petke, He Ye
TL;DR
This work presents JMigBench, a function-level benchmark for evaluating LLM-driven migrations from Java 8 to Java 11, addressing a gap where existing benchmarks focus on repository-level changes. The study constructs a ground-truth dataset across eight deprecated API categories, initially encountering noise and bias that were mitigated by curating a revised 45-function set. Using CodeBLEU and a keyword-removal metric, the Mistral Codestral model showed moderate lexical and semantic alignment with ground-truth Java 11 code and perfect migrations in only 11.11% of cases, with limited removal of certain deprecated APIs (notably CORBA and JAX-WS). The benchmark and findings reveal that LLMs can reduce developer effort for simple migrations but cannot yet replace human expertise for complex transformations, highlighting avenues for dataset expansion, prompting strategies, and cross-model evaluation in future work.
Abstract
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.
