arXiv論文メモ
新着一覧
cs.SE · 査読状況未確認

Javaのbreakとcontinueを自動的に除くAST変換

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

Andrés Juárez, José Chicano and Rubén Saborido

この論文をやさしく読む

ひとことで言うと

Javaのループ内のbreakとcontinueを、同じ動作をする別の制御構造へ自動変換するツールを作った。

何に役立つ?

メソッド抽出など、ジャンプ文のために難しい自動リファクタリングの前処理に役立つ。

この研究の面白いところ

補助的な真偽値変数を使って制御フローを組み直し、複数種類のループに対応する。

どこまで分かった?

54件の手設計テスト、151件の単体テスト、七プロジェクトの139メソッドで検証した。対象外の構文全般に対する保証は要旨からは分からない。

v1のアブストラクトに基づくAI解説。日本語訳とは別に、用途の解釈を含みます。

アブストラクトの日本語訳

Eclipse JDT APIを基盤とするJavaコードの自動リファクタリングツールを開発した。提案手法は、さまざまな種類のループ内にbreakやcontinueを含む制御構造を、その明示的な使用を避けた意味的に等価な構造へ変換する。補助的な真偽値変数を導入して制御フローを組み替え、元のプログラムの振る舞いを保つ。主な目的は、コード構造を改善し、ジャンプ文があると通常は制限されるメソッド抽出など、後続の自動リファクタリングを適用できるようにすることである。 実装は抽象構文木(AST)の解析と書き換えに基づき、扱う対象の各場合で意味的等価性を確保する。手作業で設計した54件のテストケースと151件の単体テストで検証し、全て良好な結果だった。さらに、七つのオープンソースプロジェクトの139メソッドに適用し、コンパイルエラーのないコードを生成した。各プロジェクトのテスト群によって、元の振る舞いが保たれていることも確認した。結果は、breakとcontinueを含むコードの構造変更を安全に自動化し、その後の改修や構造解析を進められることを示す。

v1の要旨から自動生成。本文の精読・人による確認は未実施。

初稿
2026-09-23(UTC)
最新改訂
2026-09-23 · v1
査読・掲載
査読状況未確認
arXivで読むPDF

更新履歴

取得できた版を表示。版の更新は査読済みを意味しません。過去版の本文差分は未解析です。

原文の要旨

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.

著者のコメント

9 pages, 1 figure. Source code available at https://github.com/andyjuarez-dev/automated-refactoring-java-code.git

arXiv ID: 2609.27627 / 要約の誤りについて