GlueTest: Testing Code Translation via Language Interoperability

Code translation from one programming language to another has been a topic of interest for academia and industry for a long time, and has recently re-emerged with the advent of Large Language Models (LLMs). While progress has been made in translating small code snippets, tackling larger projects with intricate dependencies remains a challenging task. A significant challenge in automating such translations is validating the resulting code. Translating existing tests to the target language can introduce errors, yielding potentially misleading quality assurance even when all the translated tests pass. We propose the idea of testing the translated code using the existing, untranslated tests written in the original programming language. The key to our idea is to leverage language interoperability to run code written in two different languages together. This partial translation approach offers two main benefits: (1) the ability to leverage original tests for validating translated code, not only from the project being translated but also from the clients using this project, and (2) the continuous maintainability and testability of the project during translation. We evaluate our approach by translating from Java to Python two popular Java libraries, Apache Commons CLI and Apache Commons CSV, with 1209 lines of code (in 22 Java files) and 860 lines of code (in 10 Java files), respectively. Our implementation uses Oracle's GraalVM framework for language interoperability. We successfully validate the translation using the original Java tests, not just from the CLI and CSV libraries themselves but also from client projects of these libraries (30 for CLI and 6 for CSV). Our approach is the first to systematically and semi-automatically validate translations for such nontrivial libraries.

Authors

Institutions

Publication Details

Published
2024-10-06
DOI
https://doi.org/10.1109/icsme58944.2024.00061
Citations
3
Primary Topic
Natural Language Processing Techniques
Type
article
Field-Weighted Citation Impact
1.04

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

GlueTest: Testing Code Translation via Language Interoperability

Mohamed Riduan Abid, Qingzong LIU, Sudeepta Adhikari, Rui Qi et al.
3 citations
Natural Language Processing Techniques
1.04
article

GlueTest: Testing Code Translation via Language Interoperability

Mohamed Riduan Abid, Qingzong LIU, Sudeepta Adhikari, Rui Qi, Choiyin Li, Saikat Dutta, Licheng Lin, Md Wahiduzzaman, Vishwambhar Rathi, Darko Marinov, M Atiqul Haque, Mrigank Pawagi, Xinyu Chen, Lu Liu, Asif Zubayer Palak, Rohit Sai Naidu, Ryed Badr, Xuyan Cheng
article en
3 citations

Abstract

Code translation from one programming language to another has been a topic of interest for academia and industry for a long time, and has recently re-emerged with the advent of Large Language Models (LLMs). While progress has been made in translating small code snippets, tackling larger projects with intricate dependencies remains a challenging task. A significant challenge in automating such translations is validating the resulting code. Translating existing tests to the target language can introduce errors, yielding potentially misleading quality assurance even when all the translated tests pass. We propose the idea of testing the translated code using the existing, untranslated tests written in the original programming language. The key to our idea is to leverage language interoperability to run code written in two different languages together. This partial translation approach offers two main benefits: (1) the ability to leverage original tests for validating translated code, not only from the project being translated but also from the clients using this project, and (2) the continuous maintainability and testability of the project during translation. We evaluate our approach by translating from Java to Python two popular Java libraries, Apache Commons CLI and Apache Commons CSV, with 1209 lines of code (in 22 Java files) and 860 lines of code (in 10 Java files), respectively. Our implementation uses Oracle's GraalVM framework for language interoperability. We successfully validate the translation using the original Java tests, not just from the CLI and CSV libraries themselves but also from client projects of these libraries (30 for CLI and 6 for CSV). Our approach is the first to systematically and semi-automatically validate translations for such nontrivial libraries.

Dickinson College (US), University of Shanghai for Science and Technology (CN), University of Washington (US), University of Dhaka (BD), Cornell University (US), University of Illinois System (US), City and Islington College (GB), Wuhan University (CN), BRAC University (BD), Indian Institute of Science Bangalore (IN), Zhejiang University (CN), University of California, Berkeley (US)
National Science Foundation
Openalex Percentile: Top 18%
Natural Language Processing Techniques
1.04
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.