引用本文:赵英全,张博凯,王赞,郭以勒,陈佳丽,陈翔,陈俊洁.基于大语言模型的Java新特性测试程序生成.软件学报,2026,37(7):2694-2718
【打印本页】   【下载PDF全文】   查看/发表评论  【EndNote】   【RefMan】   【BibTex】
←前一篇|后一篇→ 过刊浏览    高级检索
本文已被:浏览 1389次   下载 1002 本文二维码信息
码上扫一扫!
分享到: 微信 更多
基于大语言模型的Java新特性测试程序生成
赵英全1, 张博凯1, 王赞1, 郭以勒1, 陈佳丽2, 陈翔3, 陈俊洁1
1.天津大学 智能与计算学部, 天津300350;2.龙岩学院 数学与信息工程学院, 福建 龙岩 364012;3.南通大学 人工智能与计算机学院, 江苏 南通 226019
摘要:
Java编程语言自诞生以来, 就始终处于不断发展和演变的过程中. 随着新语言特性及编程范式的不断涌现, Java的表达能力和执行效率在不断提升, 推动了整个软件生态的进步. 为了确保Java生态的安全性和稳定性, 研究人员设计了多种针对Java编译器及虚拟机的测试程序生成方法, 以检测潜在的缺陷. 然而, 现有工作主要针对成熟的语法设计测试程序生成方法或变异策略, 难以对语言新特性进行有效的测试. 为此, 提出一种基于大语言模型的Java新特性测试程序生成方法LumiX. 首先, LumiX利用大模型对使用自然语言描述的新语言特性进行总结, 概括得到新特性的使用描述; 随后, LumiX以历史揭错测试程序作为种子程序, 利用程序分析工具提取种子程序中可复用的程序元素, 结合新特性的使用描述, 利用大模型生成针对新特性的代码片段. 新生成的代码片段将被插入至种子程序中, 生成能够覆盖新特性的测试程序. 最后, LumiX设计了双层的差分测试方法, 分别利用不同的Java编译器(javac和ECJ)及Java虚拟机(HotSpot和OpenJ9)对新生成的测试程序进行编译和执行, 通过对比不同编译器和虚拟机的执行结果来检测潜在的缺陷. 实验结果表明, LumiX能够有效生成覆盖Java语言新特性的测试程序, 并提升现有工具对Java语言新特性的测试能力. 同时, 将LumiX应用于最新发布的Java编译器以及虚拟机的测试中, 累计发现16个未知缺陷, 其中12个已被开发人员确认或修复.
关键词:  大语言模型  测试程序生成  Java编译器  Java虚拟机  编译器测试  JVM测试
DOI:10.13328/j.cnki.jos.007590
分类号:TP311
基金项目:国家重点研发计划(2024YFB4506300); 国家自然科学基金(62472310, 62322208, 62232001, 12411530122)
Java New Feature Test Program Generation Based on Large Language Models
ZHAO Ying-Quan1, ZHANG Bo-Kai1, WANG Zan1, GUO Yi-Le1, CHEN Jia-Li2, CHEN Xiang3, CHEN Jun-Jie1
1.College of Intelligence and Computing, Tianjin University, Tianjin 300350, China;2.School of Mathematics and Information Engineering, Longyan University, Longyan 364012, China;3.School of Artificial Intelligence and Computer Science, Nantong University, Nantong 226019, China
Abstract:
Since its inception, the Java programming language has been in a process of constant development and evolution. As new language features and programming paradigms continuously emerge, Java’s expressiveness and execution efficiency are steadily improving, driving progress in the whole software ecosystem. To ensure the security and stability of the Java ecosystem, researchers have designed multiple test program generation methods for Java compilers and virtual machines to detect potential defects. However, the existing research primarily focuses on designing test program generation methods or mutation strategies for mature Java syntax, making it challenging to effectively test new language features. To this end, this study proposes LumiX, a test program generation method for Java’s new features based on large language models (LLMs). First, LumiX adopts LLMs to summarize new language features using natural language descriptions and obtains the usage descriptions of the new features. Then, it employs historically bug-revealing test programs as seed programs and applies program analysis tools to extract reusable program elements from the seed programs. By combining the usage descriptions of new features, LLMs are employed to generate code snippets that incorporate the new features. The newly generated code snippets are then inserted into the seed programs to generate test programs that can cover the new features. Finally, LumiX designs a dual-layer differential testing method, which utilizes different Java compilers (javac and ECJ) and virtual machines (HotSpot and OpenJ9) to compile and execute the newly generated test programs, with potential defects detected by comparing the execution results of different compilers and virtual machines. Experimental results show that LumiX can effectively generate test programs that cover Java’s new language features and enhance the testing capabilities of existing tools for Java’s new language features. Additionally, this study applies LumiX to the latest released Java compilers and virtual machines, and a total of 16 unknown defects have been discovered, 12 of which have been confirmed or fixed by developers.
Key words:  large language model (LLM)  test program generation  Java compiler  Java virtual machine (JVM)  compiler testing  JVM testing

引用本文:
【打印本页】   【下载PDF全文】   查看/发表评论  【EndNote】   【RefMan】   【BibTex】
←前一篇|后一篇→ 过刊浏览    高级检索
本文已被:浏览次   下载  
分享到: 微信 更多
摘要:
关键词:  
DOI:
分类号:
基金项目:
Abstract:
Key words: