arXiv:2506.10999cs.SEcs.AI2025-06被引 7

用符号执行生成测试,验证COBOL转Java代码的语义等价性

Automated Validation of COBOL to Java Transformation

  • 基于符号执行自动生成带外部调用模拟的COBOL单元测试
  • 将测试转换为对应JUnit用例,验证原代码与翻译后Java代码等价
  • 可定位错误并反馈给AI模型,提升自动转换质量

大型语言模型(LLM)驱动的生成式AI技术已使将企业级遗留代码(如COBOL)自动转换为现代语言(如Java或Python)成为可能。尽管转换结果令人鼓舞,但生成的代码无法保证正确性。本文提出一个框架和工具,用于验证COBOL与翻译后Java代码之间的语义等价性。通过基于符号执行的测试生成技术,自动生成针对源COBOL程序的单元测试,并模拟外部资源调用。生成的等效JUnit测试用例在相同模拟环境下运行,以检验原始代码与翻译后代码的行为一致性。该方法不仅能识别转换中的缺陷,还可提供反馈以改进AI模型,辅助修复代码。

原文摘要 · Abstract (English)

Recent advances in Large Language Model (LLM) based Generative AI techniques have made it feasible to translate enterpriselevel code from legacy languages such as COBOL to modern languages such as Java or Python. While the results of LLM-based automatic transformation are encouraging, the resulting code cannot be trusted to correctly translate the original code. We propose a framework and a tool to help validate the equivalence of COBOL and translated Java. The results can also help repair the code if there are some issues and provide feedback to the AI model to improve. We have developed a symbolic-execution-based test generation to automatically generate unit tests for the source COBOL programs which also mocks the external resource calls. We generate equivalent JUnit test cases with equivalent mocking as COBOL and run them to check semantic equivalence between original and translated programs.

代码转换形式化验证AI生成代码COBOL迁移

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。