Leveraging LLMs for Automated Translation of Legacy Code: A Case Study on PL/SQL to Java Transformation
Lola Solovyeva, Eduardo Carneiro Oliveira, Shiyu Fan, Alper Tuncay, Shamil Gareev, Andrea Capiluppi · 2025
Read Leveraging LLMs for Automated Translation of Legacy Code: A Case Study on PL/SQL to Java Transformation by Lola Solovyeva, Eduardo Carneiro Oliveira, Shiyu Fan, Alper Tuncay, Shamil Gareev, Andrea Capiluppi (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2508-19663.txt.
Introduction
Lola Solovyeva and co-authors test whether language models can port a huge old codebase to a modern language. Their 2025 case study concerns a system of about 2.5 million lines of PL/SQL with thin documentation and no automated tests. The target is a Java rebuild of the same system.
Ten paired code samples and fifteen Java classes defined the house style for the trials. Several models were tried with a prompt plan that mixes guided steps with worked examples. Output came out clean in form and largely right in function. The authors warn the sample was small and test access was limited. Still, they see a path to scaling the approach to whole legacy estates in time.
Catalog record
| CREATOR | Lola Solovyeva, Eduardo Carneiro Oliveira, Shiyu Fan, Alper Tuncay, Shamil Gareev, Andrea Capiluppi |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 20 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2508-19663
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Leveraging LLMs for Automated Translation of Legacy Code: A Case Study on PL/SQL to Java Transformation Lola Solovyeva, Eduardo Carneiro Oliveira, Shiyu Fan, Alper Tuncay, Shamil Gareev, Andrea Capiluppi Abstract . The VT legacy system, comprising approximately 2.5 million lines of PL/SQL code, lacks consistent documentation and automated tests, posing significant challenges for refactoring and modernisation. This study investigates the feasibility of leveraging large language models (LLMs) to assist in translating PL/SQL code into Java for the modernised "VTF3" system. By leveraging a dataset comprising 10 PL/SQL-to-Java code pairs and 15 Java classes, which collectively established a domain model for the translated files, multiple LLMs were evaluated. Furthermore, we propose a customized prompting strategy that integrates chain-of-guidance reasoning with n n -shot prompting. Our findings indicate that this methodology effectively guides LLMs in generating syntactically accurate translations while also achieving functional correctness. However, the findings are limited by the small sample size of available code files and the restricted access to test cases used for validating the correctness of the generated code. Nevertheless, these findings lay the groundwork for scalable, automated solutions in modernising large legacy systems. 1. Introduction Modernization of legacy code is still one of the critical challenges in software engineering of modern world, especially for large undocumented systems ( modernizingLegacyCode ) . Many critical systems across various industries continue to rely on legacy code, particularly in languages like COBOL, Fortran, PL/SQL, and Assembly ( Benjamin2022Automated ) . A substantial portion of legacy systems within the U.S. federal government has been in operation for 30 to over 60 years, presenting considerable challenges in terms of efficiency, maintenance, workforce availability, and security ( Office_2019 ) . One of the key challenges of code modernization is the scarcity of developers proficient in legacy languages: the cost of acquiring such expertise continues to rise due to the decreasing number of professionals specializing in legacy systems ( Charette2016Dragging ) . Moreover, manual translation is a labor-intensive process that increases operational costs and prolongs the reliance on legacy system experts. For example, the Commonwealth Bank of Australia invested five years and approximately $750 million to transition its platform from COBOL to Java ( Jiaqi2024hmCodeTrans ) . Beyond purely manual code translation, the rapid expansion of code data has driven advancements in machine learning-based program translation, offering a more cost-effective and efficient alternative. The rise of LLMs for code synthesis and translation has sparked optimism about AI’s ability to enhance efficiency and reduce risks in software modernization ( Jiaqi2024hmCodeTrans ; undefined2017Modernization ; Benjamin2022Automated ) . However, developers remain cautious, especially for safety-critical legacy systems, where unintended bugs could pose significant risks ( 10.1145/3613904.3642596 ) . Although LLM-driven translation is not entirely error-free, the accurately generated code segments can serve as a valuable foundation for developers, significantly streamlining the translation process. By incorporating manual adjustments where necessary, these AI-generated outputs can reduce the cognitive and technical workload associated with code translation. This enhances overall efficiency, minimizes human effort, and decreases both operational costs and time investment, making the translation workflow more scalable and accessible. The modernization challenges are exemplified by the VT legacy system, from a large Dutch financial institution, which contains about 2.5 million lines of PL/SQL code, lacking consistent documentation and automated tests. In this state, the codebase needs to be modernized to Java for the "VTF3" system to maintain a quality in an evolving technological landscape. This paper aims to evaluate the potential of LLMs for automating the translation of such massive legacy systems and consequently reduce the human effort involved in modernizing legacy codebases. Our goal is therefore focused on establishing a methodology resulting in a codebase that is syntactically correct and functional within the requirements of the newly modernized code. The contributions of our study are threefold: • An evaluation of the ability of LLMs to translate PL/SQL code into Java using prompting strategies. • The development of a prompting methodology aimed at improving both the syntactical and functional accuracy of the translated code. • An analysis of key factors that influence the successful translation of code. Our findings indicate that incorporating a domain model, which guides the LLM to generate code in a specific format, and using a targeted set of translation examples, leads to more effective outcomes. Additionally, the success of our approach depends more on the similarity of the provided samples to the translation task than on their quantity. Finally, this method is adaptable to other language-to-language translation tasks beyond PL/SQL and Java, as it is not language-specific. Provide context to the LLM Ask for a prompting strategy Provide domain model Provide PL/SQL-Java pairs Ask for a translation Figure 1. A flowchart illustrating the pipeline of interaction with the LLMs through prompting and chain-of-guidance. 2. Related Work The rapid advancement in LLMs has significantly impacted various domains of software engineering, particularly in automating complex tasks like code translation, modernisation and maintenance. This section reviews key contributions in three areas: the role of LLMs in software maintenance and legacy systems; recent approaches to automating code translation and modernisation; and the evaluation and benchmarking of LLMs for code transformation tasks. Recent research highlights the integration of LLMs in software engineering for tasks like requirements engineering, coding assistance, testing and maintenance ( Gao2025Current ; He2025LLM ; Wang2024Software ) . LLMs can enhance productivity by automating tasks such as code generation, code completion and comment classification ( Wong2023Natural ; Patel2025State ) . However, some challenges remain regarding model robustness, ethical considerations and the need for human oversight ( Marques2024Using ; France2024Navigating ) . Frameworks for assessing LLM ‘readiness’ ( Patel2025State ) and multi-agent systems for addressing complex software engineering challenges ( He2025LLM ) have been proposed. Our study complements this body of work by demonstrating a practical implementation of LLM-driven code modernization, evaluating its feasibility in a real-world large-scale legacy system. Code translation and modernization are crucial for updating legacy systems and improving software efficiency. Various approaches have been proposed, including human-machine collaboration for interactive code translation ( Jiaqi2024hmCodeTrans ) and incremental modernization of legacy CFD codes ( undefined2017Modernization ) . Neural-guided program synthesis has shown promise in automating the transpilation of imperative to functional code ( Benjamin2022Automated ) . Microservices architecture has been explored as a strategy for legacy software modernization, offering improved maintainability and scalability ( Knoche2018Using ) . We advance this work by using LLMs to automate PL/SQL-to-Java translation, refining prompting techniques and introducing cosine similarity-based methods to improve translation accuracy. The evaluation of LLMs for code generation and summarisation is an emerging field. Several studies propose frameworks and methodologies for assessing LLMs’ code synthesis capabilities, including functional and non-functional qualities ( Sagodi2024Methodology ; Yeo2024Framework ) . Researchers have also developed benchmarks for evaluating LLMs in specific domains, such as programming service mobile robots ( Hu2024Deploying ) and bug reproduction ( kang2024evaluating ) . The importance of comprehensive evaluation across multiple dimensions, including validity, legality, and readability, has been emphasized ( Chen2025VisEval ) . Studies have highlighted the significance of instruction tuning and the need for high-quality reference data in summarization tasks ( Zhang2024Benchmarking ) . Additionally, researchers have called for multi-prompt evaluations to address the brittleness of single-prompt assessments ( Mizrahi2024State ) . Our work contributes to