一句话:提出 HERCULES,利用测试谱、代码相似性与版本历史定位演化兄弟并同时修复多 hunk 缺陷。
自动程序修复(APR)虽取得显著进展,但仍难以实际部署,其中一个重要瓶颈是当前技术通常无法生成需要在多个位置修改的多 hunk 补丁。本文提出一种新的 APR 技术,将单 hunk 修复推广到一类重要的多 hunk 缺陷:需要在多个位置施加高度相似补丁的缺陷,并将这些修复位置称为“演化兄弟”(evolutionary siblings),即代码相似、上下文相似且预期发生相似变更的位置。方法核心是准确识别给定缺陷的演化兄弟集合,分析综合了测试套件谱、一种新的代码相似性分析以及项目的修订历史;识别出的兄弟位置随后以相似方式被同时修复。作者将该技术实现为 HERCULES,并在 Defects4J 数据集上评估,正确修复了 46 个缺陷,其中包含 15 个多 hunk 缺陷,并有 11 个缺陷此前未被其他技术修复,达到当时单个 APR 技术的最高修复数量。
Despite significant advances in automatic program repair (APR) techniques over the past decade, practical deployment remains an elusive goal. One of the important challenges in this regard is the general inability of current APR techniques to produce patches that require edits in multiple locations, i.e., multi-hunk patches. In this work, we present a novel APR technique that generalizes single-hunk repair techniques to include an important class of multi-hunk bugs, namely bugs that may require applying a substantially similar patch at a number of locations. We term such sets of repair locations as evolutionary siblings - similar looking code, instantiated in similar contexts, that are expected to undergo similar changes. At the heart of our proposed method is an analysis to accurately identify a set of evolutionary siblings, for a given bug. This analysis leverages three distinct sources of information, namely the test-suite spectrum, a novel code similarity analysis, and the revision history of the project. The discovered siblings are then simultaneously repaired in a similar fashion. We instantiate this technique in a tool called HERCULES and demonstrate that it is able to correctly fix 46 bugs in the Defects4J dataset, the highest of any individual APR technique to date. This includes 15 multi-hunk bugs and overall 11 bugs which have not been fixed by any other technique so far.