AST-Based Automated Elimination of break and continue Statements in Java Code

📅 2026-09-23
📈 Citations: 0
✨ Influential: 0
📄 PDF
🤖 AI Summary
本文提出了一种基于Eclipse JDT API的自动重构工具,通过引入辅助布尔变量转换含有break和continue语句的Java代码结构,以改善代码结构并支持进一步的自动化重构。
📝 Abstract
This work presents the development of an automatic refactoring tool for Java code built on top of the Eclipse JDT API. The proposed approach transforms control structures containing break and continue statements within different types of loops into semantically equivalent constructs that avoid their explicit use. To achieve this, auxiliary boolean variables are introduced to restructure the control flow while preserving the original program behavior. The main objective of this transformation is to improve code structure and enable the application of subsequent automated refactorings, particularly those based on the Extract Method operation, which are typically restricted by the presence of jump statements. The implementation relies on the analysis and rewriting of the Abstract Syntax Tree (AST), ensuring semantic equivalence in all addressed scenarios. The tool was validated through 54 manually designed test cases and 151 units tests, all of which produced satisfactory results. In addition, it was applied to 139 methods from seven open-source projects, generating code without compilation errors and preserving the original behavior as verified by the projects' test suites. The results demonstrate that the proposed approach safely automates the restructuring of code containing break and continue statements, facilitating further evolution and structural analysis.
Problem

Research questions and friction points this paper is trying to address.

break and continue statements
code structure
automated refactoring
Extract Method
Abstract Syntax Tree (AST)
Innovation

Methods, ideas, or system contributions that make the work stand out.

AST
Automated Refactoring
Control Flow Restructuring
Break and Continue Elimination
🔎 Similar Papers
No similar papers found.
A
Andrés Juárez
University of Málaga, Málaga, Spain
J
José Chicano
University of Málaga, Málaga, Spain
R
Rubén Saborido
University of Málaga, Málaga, Spain