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.
翻译:上下文:Bug二分法是一种常用的识别引入缺陷或间接修复缺陷的技术,通常需要执行项目的多个版本来判断缺陷是否存在于某版本中。然而,许多历史版本常因编程语言或编译过程中使用的工具变更而无法成功编译,增加了复杂性并阻碍了二分过程的自动化。目标:本文提出一种通过依赖最小化来修复Java项目测试用例的方法。该方法旨在移除执行一个或多个测试用例时不必要的类和方法。与现有最先进技术不同,我们的方法在源代码级别执行最小化,从而能够修复编译时错误。方法:开发了一个实现该技术的独立Java工具,并使用针对Java 8和17重新定制的Defects4J测试对象进行评估。结果:评估表明,仅通过执行最小化即可修复大多数测试对象,包括复现原始版本的测试结果。此外,我们的技术还能获得精确的最小化结果,同时仅对二分过程增加微小开销。结论:所提出的技术能够有效修复构建失败且开销极低,适用于自动化Bug二分法。该工具还可用于错误语料库创建和重构等场景。