一句话:提出迭代式神经修复范式 ITER,通过持续改进部分补丁实现单/多位置修复,在 Defects4J 2.0 上修复 15.5% 的 bug。
自动程序修复(APR)尤其是基于神经网络的方法已取得进展,但绝大多数 APR 工具产生的补丁局限于单一位置;神经修复生成的补丁大多无法编译,少数不可编译补丁方向正确,其根本问题在于忽略了部分补丁的潜力。本文提出迭代式修复范式 ITER,基于“不断改进部分补丁直至其成为看似合理且正确的补丁”这一理念:首先迭代改进单位置部分补丁,修复编译错误并精炼已生成代码;其次借助故障定位重执行,迭代改进部分补丁以构造多位置补丁。ITER 基于成熟的深度神经网络与代码表示在 Java 上实现,并在 Defects4J 2.0 的 10 个开源项目的 476 个 bug 上评估,成功修复 15.5%,其中包括 9 个被唯一修复的多位置 bug。
Automated program repair (APR) has achieved promising results, especially using neural networks. Yet, the overwhelming majority of patches produced by APR tools are confined to one single location. When looking at the patches produced with neural repair, most of them fail to compile, while a few uncompilable ones go in the right direction. In both cases, the fundamental problem is to ignore the potential of partial patches. In this paper, we propose an iterative program repair paradigm called ITER founded on the concept of improving partial patches until they become plausible and correct. First, ITER iteratively improves partial single-location patches by fixing compilation errors and further refining the previously generated code. Second, ITER iteratively improves partial patches to construct multi-location patches, with fault localization re-execution. ITER is implemented for Java based on battle-proven deep neural networks and code representation. ITER is evaluated on 476 bugs from 10 open-source projects in Defects4J 2.0. ITER succeeds in repairing 15.5% of them, including 9 uniquely repaired multi-location bugs.