Skip to main content
QUICK REVIEW

[论文解读] ARJA: Automated Repair of Java Programs via Multi-Objective Genetic Programming

Yuan Yuan, Wolfgang Banzhaf|arXiv (Cornell University)|Dec 21, 2017
Software Testing and Debugging TechniquesComputer Science参考文献 56被引用 17
一句话总结

ARJA 提出了一种基于多目标遗传编程的自动修复 Java 程序的方法,采用细粒度补丁表示和 NSGA-II 算法,同时优化测试用例充分性和补丁简洁性。在 Defects4J 中的 224 个真实世界错误中,ARJA 生成了 59 个测试用例充分的补丁,是 jGenProg 的两倍以上,并正确修复了 18 个错误,包括若干此前其他工具无法修复的多位置错误。

ABSTRACT

Recent empirical studies show that the performance of GenProg is not satisfactory, particularly for Java. In this paper, we propose ARJA, a new GP based repair approach for automated repair of Java programs. To be specific, we present a novel lower-granularity patch representation that properly decouples the search subspaces of likely-buggy locations, operation types and potential fix ingredients, enabling GP to explore the search space more effectively. Based on this new representation, we formulate automated program repair as a multi-objective search problem and use NSGA-II to look for simpler repairs. To reduce the computational effort and search space, we introduce a test filtering procedure that can speed up the fitness evaluation of GP and three types of rules that can be applied to avoid unnecessary manipulations of the code. Moreover, we also propose a type matching strategy that can create new potential fix ingredients by exploiting the syntactic patterns of the existing statements. We conduct a large-scale empirical evaluation of ARJA along with its variants on both seeded bugs and real-world bugs in comparison with several state-of-the-art repair approaches. Our results verify the effectiveness and efficiency of the search mechanisms employed in ARJA and also show its superiority over the other approaches. In particular, compared to jGenProg (an implementation of GenProg for Java), an ARJA version fully following the redundancy assumption can generate a test-suite adequate patch for more than twice the number of bugs (from 27 to 59), and a correct patch for nearly four times of the number (from 5 to 18), on 224 real-world bugs considered in Defects4J. Furthermore, ARJA is able to correctly fix several real multi-location bugs that are hard to be repaired by most of the existing repair approaches.

研究动机与目标

  • 解决现有基于测试用例的修复工具(如 GenProg 和 jGenProg)在真实世界 Java 错误上的有效性有限的问题。
  • 通过解耦错误位置、操作类型和修复元素的搜索空间,提升遗传编程在程序修复中的表达力与效率。
  • 通过测试过滤和作用域感知的代码操作规则,降低计算成本。
  • 通过集成类型匹配策略,生成语法正确且语义相关的修复元素,提升修复质量。
  • 证明当结构合理且优化得当时,遗传编程可有效应用于复杂的真实世界错误修复。

提出的方法

  • 提出一种更细粒度的补丁表示方法,将搜索空间解耦为三个独立子空间:可能出错的位置、操作类型(如删除、替换)以及潜在的修复元素。
  • 将程序修复重新表述为一个多目标优化问题,通过最小化加权失败率和补丁大小来求解,使用 NSGA-II 找到帕累托最优解。
  • 采用测试过滤程序,在适应度评估期间跳过无关测试,从而加速遗传编程过程。
  • 在操作初始化、元素筛选和解码解决方案阶段,应用三类规则——作用域限制、编译安全性检查和操作特定约束——以减少无效代码的生成。
  • 提出一种类型匹配策略,通过分析作用域外语句的语法模式,生成与目标方法类型上下文匹配的新颖、有效的修复元素。
  • 可选地集成该类型匹配策略,使生成的代码片段不仅语法正确,且语义合理,即使这些片段在源代码中原本不存在。

实验结果

研究问题

  • RQ1与现有最先进工具相比,多目标遗传编程方法是否能显著提升真实世界 Java 错误修复的有效性与效率?
  • RQ2细粒度补丁表示方法(通过解耦搜索子空间)在多大程度上提升了基于 GP 的修复的搜索效率与修复质量?
  • RQ3所提出的类型匹配策略在生成语义有效且可重用的 Java 程序修复元素方面有多有效?
  • RQ4ARJA 是否能够成功修复那些对现有修复工具而言极为困难的多位置错误?
  • RQ5测试过滤与基于规则的代码操作是否显著降低了基于 GP 的修复中适应度评估的计算成本?

主要发现

  • ARJA 在 Defects4J 的 224 个真实世界错误中,生成了 59 个测试用例充分的补丁,而 jGenProg 生成了 27 个,Nopol 生成了 35 个,表明修复覆盖率有显著提升。
  • ARJA 正确修复了 Defects4J 中的 18 个真实世界错误,几乎是 jGenProg(5 个错误)的四倍,且包括 7 个首次被自动修复的错误。
  • 类型匹配策略显著提升了修复有效性,采用该策略的 ARJA 变体修复了比主版本更多的错误。
  • ARJA 成功修复了若干复杂的多位置错误,而大多数现有修复工具仍无法处理,凸显其在处理语义复杂修复方面的能力。
  • 测试过滤程序通过剔除无关测试,显著减少了适应度评估时间,提升了计算效率。
  • 采用 NSGA-II 的多目标优化方法有效平衡了补丁简洁性与测试用例充分性,从而生成了质量更高、更易维护的补丁。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。