Automated program repair is a crucial task for improving the efficiency of software developers. Recently, neural-based techniques have demonstrated significant promise in generating correct patches for buggy code snippets. However, most existing approaches arbitrarily treat the buggy context without any analysis to capture the semantic relationship between the buggy statement and its context. Additionally, we observe that existing neural models may output an unaltered patch consistent with the input buggy code snippet, which fails to be the correct human-written one for fixing the given bug. To address the aforementioned limitations, we present in this paper a novel neural program repair framework called \approach, which adapts the general pre-trained language model for fixing single-line Java bugs. We make the first attempt to use program slicing to extract contextual information directly related to the given buggy statement as repair ingredients from the corresponding program dependence graph and eliminate unaltered patches using an intuitive but effective filter mechanism. We demonstrate the effectiveness of \approach on five benchmarks when compared with state-of-the-art baselines.
翻译:摘要: 自动化程序修复是提升软件开发效率的关键任务。近年来,基于神经网络的修复技术在生成错误代码片段的正确补丁方面展现出显著潜力。然而,现有方法大多任意处理缺陷上下文,缺乏对缺陷语句及其上下文之间语义关系的分析。此外,我们观察到现有神经模型可能输出与输入错误代码片段一致的未修改补丁,这无法成为修复给定缺陷的正确人工补丁。针对上述局限,本文提出一种新型神经程序修复框架\approach,该框架适配通用预训练语言模型以修复单行Java缺陷。我们首次尝试利用程序切片技术从对应程序依赖图中提取与缺陷语句直接相关的上下文信息作为修复要素,并通过直观且有效的过滤机制消除未修改补丁。与最先进基线相比,我们在五个基准数据集上验证了\approach方法的有效性。