J2KMigBench: Evaluating LLMs on Java-to-Kotlin Migration in Real-World Repositories

Fakorede, Moshood A., Rubio-Gonzalez, Marcoantoni, Farooq, Umar

–arXiv.org Artificial Intelligence 

Migrating Java to Kotlin requires preserving behavior and interfaces within a working repository. Existing callers, build configurations, and tests constrain translation. Java/Kotlin interoperability also allows partial and incomplete migrations to keep passing tests. A migration is incomplete if it does not replace every requested Java file with its Kotlin counterpart. We present J2KMigBench, a benchmark drawn from real migration pull requests. Each task combines the original Java, a specification grounded in the source and pull request, and an offline build environment with the developer's Kotlin withheld from the agent. From 383 candidate pull requests, environment and task checks yield 31 evaluable tasks across six repositories and 167 target files. We evaluate Gemini 3.8 Flash and GPT-6.1 Terra using OpenHands under identical task budgets. Resolution requires compilation, preservation of stable baseline tests, and conversion of every requested file. Gemini resolves 25 tasks (80.6%) and Terra 26 (83.9%), at mean model costs of USD 1.25 and USD 0.15. Six patches compile and preserve the tests while converting at most one target file. Gemini converts more files overall and is closer to the developer's Kotlin on shared targets, with mean token edit similarity of 0.57 against Terra's 0.53. Analysis of selected Kotlin constructs reveals different null-handling and accessor choices without establishing a ranking of idiomaticity. The benchmark exposes incomplete conversions and caller incompatibilities that build success or reference similarity alone would miss.