Table of Contents
Fetching ...

Automatic Build Repair for Test Cases using Incompatible Java Versions

Ching Hang Mak, Shing-Chi Cheung

TL;DR

The paper tackles the problem of build failures in automated bug bisection when snapshots cannot be compiled under newer Java versions. It introduces test dependency minimization at the source level, driven by a reachability-based two-phase (mark-sweep) minimization that preserves test behavior while removing unused program declarations. A suite of optimizations (dynamic-dispatch devirtualization and generics propagation) and iterative passes improve precision and enable efficient repair across Defects4J subjects on Java 8 and 17, with overhead typically in the low seconds. The approach enables automated bisection across evolving Java toolchains, expands usable subject pools for bug corpus creation, and offers a foundation for integration with refactoring tools and build-repair pipelines.

Abstract

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.

Automatic Build Repair for Test Cases using Incompatible Java Versions

TL;DR

The paper tackles the problem of build failures in automated bug bisection when snapshots cannot be compiled under newer Java versions. It introduces test dependency minimization at the source level, driven by a reachability-based two-phase (mark-sweep) minimization that preserves test behavior while removing unused program declarations. A suite of optimizations (dynamic-dispatch devirtualization and generics propagation) and iterative passes improve precision and enable efficient repair across Defects4J subjects on Java 8 and 17, with overhead typically in the low seconds. The approach enables automated bisection across evolving Java toolchains, expands usable subject pools for bug corpus creation, and offers a foundation for integration with refactoring tools and build-repair pipelines.

Abstract

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.
Paper Structure (60 sections, 1 figure, 14 tables)