Formalizing and Automating Fine-Grained Move Refactorings Across Methods
Kota Yasuhara, Shinpei Hayashi
Key points
From the paper's conclusion- We evaluate applicability and compilability on ten projects, and behavior preservation in a case study on one of them: Move Statement refactorings yield compilable code in 93.3-97.0% of applicable cases, and the case study shows that the observed behavioral changes stem from side-effect reordering left to developer judgment, not from defects in the statically checked conditions.
Abstract
Developers use automated Move refactorings to improve the modular structure of source code and the assignment of responsibilities. Class- and method-level Move refactorings are automated in modern IDEs, but statement- and expression-level moves that adjust method boundaries remain largely unautomated. We formalize five variants of Move Statement refactoring as preconditions and steps grounded in four basic conditions covering data reachability, execution count, side effects, and syntactic constraints required for compilation, of which all but the side-effect condition are checked statically. Combined with existing techniques, this also yields finer-grained moves of expressions and partial expressions. We further refine the formalization iteratively against a real project, deriving twenty additional preconditions and steps that handle Java syntactic diversity in practice. We evaluate applicability and compilability on ten projects, and behavior preservation in a case study on one of them: Move Statement refactorings yield compilable code in 93.3-97.0% of applicable cases, and the case study shows that the observed behavioral changes stem from side-effect reordering left to developer judgment, not from defects in the statically checked conditions.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Testing Method Relocation Algorithms via Template-Based Systematic Structural Traversal and Precondition FilteringProceedings of the ACM on Software Engineering · 2026
- Multi-Agent Coordinated Method-Level Refactoring of Rust CodearXiv · 2026
- From Custom Logic to APIs: Understanding and Recommending API Replacement RefactoringsProceedings of the ACM on Software Engineering · 2026
- Software Refactoring Research with Large Language Models: A Systematic Literature ReviewarXiv · 2026
- FrontierRefactor: Benchmarking Multi-Scale Performance-Oriented Codebase RefactoringarXiv · 2026
- LLM-Assisted Software Migration: from Module-Level Transformation to Repository-Level IntegrationarXiv · 2026