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.
翻译:自动程序修复(APR)已取得令人瞩目的成果,尤其是基于神经网络的方案。然而,APR工具生成的补丁绝大多数局限于单个位置。在神经修复生成的补丁中,大部分无法通过编译,而少数不可编译的补丁虽方向正确,但根本问题在于忽视了部分补丁的潜力。本文提出一种名为ITER的迭代式程序修复范式,其核心概念是通过持续改进部分补丁,最终使其成为合理且正确的完整补丁。首先,ITER通过修复编译错误并进一步优化先前生成的代码,迭代改进单位置部分补丁;其次,ITER通过重新执行故障定位,迭代构建多位置部分补丁。ITER基于经过实战验证的深度神经网络与代码表示技术,在Java语言中实现。我们在Defects4J 2.0中10个开源项目的476个缺陷上评估了ITER,成功修复其中15.5%的缺陷,包括9个由ITER独特完成的多位置缺陷修复。