Page 272 - 《软件学报》2026年第5期
P. 272
软件学报 ISSN 1000-9825, CODEN RUXUEW E-mail: jos@iscas.ac.cn
2026,37(5):2151−2166 [doi: 10.13328/j.cnki.jos.007510] [CSTR: 32375.14.jos.007510] http://www.jos.org.cn
©中国科学院软件研究所版权所有. Tel: +86-10-62562563
*
基于代码变更语义分析的缺陷隔离方法
刘书宁 1,2 , 吴毅坚 1,2 , 宋学志 1,2 , 陈碧欢 1,2 , 彭 鑫 1,2 , 赵文耘 1,2
1
(复旦大学 计算与智能创新学院, 上海 200438)
2
(上海市数据科学重点实验室 (复旦大学), 上海 200438)
通信作者: 吴毅坚, E-mail: wuyijian@fudan.edu.cn
摘 要: 在现代软件开发中, 频繁的代码提交和更新已成为常态, 虽然加速了功能实现, 但更可能会引入新的缺陷,
进而威胁软件的稳定性和可靠性. 一旦缺陷导致程序错误或故障, 开发团队必须迅速采取行动隔离缺陷以确保系
统持续正常运行. 缺陷隔离是快速定位问题并恢复系统稳定性的关键技术手段, 但传统的增量调试 (delta
debugging, DD) 方法依赖大量测试尝试, 导致在变更集合较大时性能瓶颈明显, 且缺乏对代码变更语义的有效利
用, 无法精准定位与缺陷相关的代码变更. 提出了一种基于代码变更语义分析的缺陷隔离方法——DISAC. 该方法
通过将缺陷引入的复合提交拆解为具有单一功能语义的原子提交, 并通过建模提交之间的顺序依赖关系, 确保隔
离过程中不破坏变更间的前置依赖. 与传统的 DD 方法相比, DISAC 不仅能够返回最小的功能语义变更, 还能保留
必要的上下文和依赖信息, 从而为开发人员提供更完整、精确的缺陷修复支持. 实验结果表明, 与 DD 方法相比,
DISAC 在缺陷隔离效率和精度上均有显著提升. 具体而言, DISAC 在 Defects4J 数据集上的隔离效率提高了
633.65%, 在回归缺陷集上的效率提升了 733.75%. 此外, 当 DISAC 与 DD 结合使用时, 约减率分别提高了 2.36%
和 8.66%, 显著提高了隔离效果. 用户实验显示, DISAC 能提高根因确定效率约 59.90%, 准确率提升 12%. 这些结
果表明, DISAC 在提高缺陷隔离精度的同时减少了不必要的变更组合尝试, 从而在复杂代码提交的缺陷隔离任务
中表现出更高的效率和稳定性.
关键词: 缺陷隔离; 代码变更; 语义分析; 大语言模型
中图法分类号: TP311
中文引用格式: 刘书宁, 吴毅坚, 宋学志, 陈碧欢, 彭鑫, 赵文耘. 基于代码变更语义分析的缺陷隔离方法. 软件学报, 2026, 37(5):
2151–2166. http://www.jos.org.cn/1000-9825/7510.htm
英文引用格式: Liu SN, Wu YJ, Song XZ, Chen BH, Peng X, Zhao WY. Defect Isolation Method Based on Semantic Analysis of Code
Changes. Ruan Jian Xue Bao/Journal of Software, 2026, 37(5): 2151–2166 (in Chinese). http://www.jos.org.cn/1000-9825/7510.htm
Defect Isolation Method Based on Semantic Analysis of Code Changes
1,2
1,2
1,2
1,2
1,2
LIU Shu-Ning , WU Yi-Jian , SONG Xue-Zhi , CHEN Bi-Huan , PENG Xin , ZHAO Wen-Yun 1,2
1
(College of Computer Science and Artificial Intelligence, Fudan University, Shanghai 200438, China)
2
(Shanghai Key Laboratory of Data Science (Fudan University), Shanghai 200438, China)
Abstract: In modern software development, frequent code commits and updates have become the norm, which accelerates feature
implementation but may introduce new defects, thus threatening software stability and reliability. Once a defect causes program errors or
failures, the development team should take quick action to isolate the defect to ensure the continuous operation of the system. Defect
isolation is a key technique for rapidly locating the problem and restoring system stability. However, the traditional delta debugging (DD)
methods rely on numerous testing attempts, resulting in significant performance bottlenecks under a large change set. Additionally, they
fail to effectively utilize the semantics of code changes, making it difficult to accurately locate defect-related code changes. This study
* 基金项目: 国家自然科学基金 (62172099)
收稿时间: 2024-12-19; 修改时间: 2025-05-12; 采用时间: 2025-08-12; jos 在线出版时间: 2025-11-05
CNKI 网络首发时间: 2025-11-06

