Previous studies have shown that Automated Program Repair (APR) techniques suffer from the overfitting problem. Overfitting happens when a patch is run and the test suite does not reveal any error, but the patch actually does not fix the underlying bug or it introduces a new defect that is not covered by the test suite. Therefore, the patches generated by apr tools need to be validated by human programmers, which can be very costly, and prevents apr tool adoption in practice. Our work aims to minimize the number of plausible patches that programmers have to review, thereby reducing the time required to find a correct patch. We introduce a novel light-weight test-based patch clustering approach called xTestCluster, which clusters patches based on their dynamic behavior. xTestCluster is applied after the patch generation phase in order to analyze the generated patches from one or more repair tools and to provide more information about those patches for facilitating patch assessment. The novelty of xTestCluster lies in using information from execution of newly generated test cases to cluster patches generated by multiple APR approaches. A cluster is formed of patches that fail on the same generated test cases. The output from xTestCluster gives developers a) a way of reducing the number of patches to analyze, as they can focus on analyzing a sample of patches from each cluster, b) additional information attached to each patch. After analyzing 902 plausible patches from 21 Java APR tools, our results show that xTestCluster is able to reduce the number of patches to review and analyze with a median of 50%. xTestCluster can save a significant amount of time for developers that have to review the multitude of patches generated by apr tools, and provides them with new test cases that expose the differences in behavior between generated patches.
How Different Is It Between Machine-Generated and Developer-Provided Patches? An Empirical Study on The Correct Patches Generated by Automated Program Repair Techniques
背景资料:多年来,自动程序修复(Automated Program Repair,APR)由于能够降低修复错误的成本而受到学术界和工业界的广泛关注。然而,如何评估补丁的正确性仍然是一个开放的挑战。两种广泛采用的方法来应对这一挑战,包括手动检查和使用自动生成的测试进行验证,都是有偏见的(即,分别遭受主观性和低精度)。目的:为了解决这一问题,我们建议进行实证研究,了解正确的补丁,由现有的国家的最先进的APR技术,旨在为未来的补丁评估提供指导方针。方法:为此,我们首先提出了一个文献综述(LR)报告的正确补丁生成的最新技术的缺陷4J基准和收集177个正确的补丁后,健全检查的过程。我们研究了这些机器生成的正确补丁是如何实现语义等价的,但与开发人员提供的补丁相比在语法上存在差异,这些补丁如何在不同的项目和APR技术中分布,以及错误的特征如何影响为其生成的补丁。我们的主要发现包括:1)我们不需要像开发人员那样修复bug,因为我们观察到25.4%(45/177)2)机器生成的正确补丁的分布在Defects 4J项目和APR技术方面存在差异;以及3)APR技术倾向于生成与开发者针对具有大补丁大小的错误所生成的补丁不同的补丁。结论:我们的研究不仅验证了以前的研究结论,但也强调了未来的研究对评估补丁的正确性的影响。