Journal Article

ClassEval-T: Evaluating Large Language Models in Class-Level Code Translation.

Pengyu Xue, Linhao Wu, Zhen Yang, Chengyi Wang, Xiang Li, Yuxiang Zhang, Jia Li, Ruikai Jin, Yifei Pei, Zhaoyan Shen, Xiran Lyu, Jacky W. Keung
Proc. ACM Softw. Eng. 2025 10.1145/3728940

Abstract

ClassEval-T: Evaluating Large Language Models in Class-Level Code Translation PENGYU XUE∗ , Shandong University, China LINHAO WU∗ , Shandong University, China ZHEN YANG† , Shandong University, China CHENGYI WANG, Shandong University, China XIANG LI, Shandong University, China YUXIANG ZHANG, Shandong University, China JIA LI, Tsinghua University, China RUIKAI JIN, Shandong University, China YIFEI PEI, Shandong University, China ZHAOYAN SHEN, Shandong University, China XIRAN LYU, Shandong University, China JACKY WAI KEUNG, City University of Hong Kong, China In recent years, Large Language Models (LLMs) have dramatically advanced the performance of automated code translation, making their computational accuracy score reach up to over 80% on many previous benchmarks. However, most code samples in these benchmarks are short, standalone, statement/method-level, and algorithmic, which is not aligned with practical coding tasks. Therefore, it is still unknown the actual capability of LLMs in translating code samples written for daily development. To achieve this, we construct a class-level code translation benchmark, ClassEval-T, and make the first attempt to extensively assess recent LLMs' performance on class-level code translation. ClassEval-T is extended from ClassEval, a well-known class-level Python code generation benchmark consisting of multiple practical coding topics, such as database operation and game design, and diverse contextual dependencies (e.g., fields, methods, and libraries). It cost us 360 person-hours to accomplish the manual migration to Java and C++ with complete code samples and associated test suites. Subsequently, we design three translation strategies (i.e., holistic, min-dependency, and standalone) for class-level code translations and evaluate eight recent LLMs of commercial, general, and code kinds in diverse families and sizes on ClassEval-T. Experimental results demonstrate a remarkable performance drop compared with the most widely studied method-level code translation benchmark, and obvious discrepancies among LLMs appear, showing the effectiveness ∗ These authors contributed equally to this work. † Corresponding author.

Keywords