Context: Bug bisection is a common technique used to identify a revision that introduces a bug or indirectly fixes a bug, and often involves executing multiple revisions of a project to determine whether the bug is present within the revision. However, many legacy revisions often cannot be successfully compiled due to changes in the programming language or tools used in the compilation process, adding complexity and preventing automation in the bisection process. Objective: In this paper, we introduce an approach to repair test cases of Java projects by performing dependency minimization. Our approach aims to remove classes and methods that are not required for the execution of one or more test cases. Unlike existing state-of-the-art techniques, our approach performs minimization at source-level, which allows compile-time errors to be fixed. Method: A standalone Java tool implementing our technique was developed, and we evaluated our technique using subjects from Defects4J retargeted against Java 8 and 17. Results: Our evaluation showed that a majority of subjects can be repaired solely by performing minimization, including replicating the test results of the original version. Furthermore, our technique is also shown to achieve accurate minimized results, while only adding a small overhead to the bisection process. Conclusion: Our proposed technique is shown to be effective for repairing build failures with minimal overhead, making it suitable for use in automated bug bisection. Our tool can also be adapted for use cases such as bug corpus creation and refactoring.
翻译:上下文:缺陷二分法是一种常见的技术,用于识别引入缺陷或间接修复缺陷的修订版本,通常需要执行项目的多个修订版本来判断该修订版本中是否存在缺陷。然而,由于编程语言或编译过程中使用的工具发生变化,许多遗留修订版本往往无法成功编译,这增加了复杂度并阻碍了二分过程的自动化。目标:本文提出一种通过依赖最小化来修复Java项目测试用例的方法。该方法旨在移除执行一个或多个测试用例时不需要的类和方法。与现有先进技术不同,该方法在源代码级别进行最小化,从而能够修复编译时错误。方法:我们开发了一款实现该技术的独立Java工具,并使用基于Defects4J(重新针对Java 8和17)的测试对象进行评估。结果:评估表明,大多数测试对象仅通过最小化即可修复,包括复现原始版本的测试结果。此外,该技术能够实现精确的最小化结果,且仅给二分过程增加少量开销。结论:所提出的技术在最小化开销的情况下有效修复构建失败,适用于自动化缺陷二分法。我们的工具还可适配于缺陷语料创建和重构等应用场景。