Search papers, labs, and topics across Lattice.
This paper formalizes five variants of Move Statement refactoring, addressing the automation gap in statement- and expression-level moves that adjust method boundaries in source code. By establishing preconditions and steps based on data reachability, execution count, side effects, and syntactic constraints, the authors enhance the modular structure of code while ensuring compilability. The evaluation across ten projects demonstrates a high success rate of 93.3-97.0% for producing compilable code, with behavioral changes attributed to developer discretion rather than flaws in the automated checks.
Move Statement refactorings can achieve up to 97% compilability, revealing that developer judgment is the main source of behavioral changes, not automation flaws.
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.