Ace8 is the modernization practice of AceMQ.24/7 support from AceMQ after go-live
Book an Assessment

Guide

AI code refactoring: use rules where you can, models where you must.

Two kinds of tool are called AI refactoring. They fail in different ways, so they need different checks.

AceMQ engineering team3 min readEngineer-reviewed

Try it: same input, run againIllustration of the difference, not measured output.

OpenRewriteRule-based recipes

RateParser.java- Integer rate = new Integer(value);+ Integer rate = Integer.valueOf(value);diff a3f9c1e

Identical diff on every run

LLM-based refactoringAI-driven rewrite

RateParser.java- Integer rate = new Integer(value);+ Integer rate = Integer.valueOf(value);diff a3f9c1e

Press Run again: does the diff change?

The short answer

AI code refactoring covers two kinds of tool. Deterministic recipe engines such as OpenRewrite apply fixed rules and give the same result every run. LLM-based tools generate edits and can handle cases rules miss, but vary between runs. Use recipes for mechanical changes, an LLM for the remainder, and gate both with tests and engineer review.

On this page

  • OpenRewrite
  • Java
  • AWS Transform
  • GitHub Copilot
  • Spring Boot
  • Jakarta EE
  • OpenRewrite
  • Java
  • AWS Transform
  • GitHub Copilot
  • Spring Boot
  • Jakarta EE

Definitions

Two things people call AI refactoring

Some products combine both. Read what a tool does under the hood before you decide how much to trust its output.

Deterministic recipesLLM-based refactoring
How it worksParses code to a tree and applies explicit rulesA model reads code and generates new code
RepeatableYes, same input gives the same diffNo, output can differ between runs
StrengthMechanical changes across many filesCases with no rule: odd APIs, glue code, local conventions
Typical failureDoes nothing when no recipe matchesPlausible but wrong code, invented APIs, silent behavior change
ExampleOpenRewriteTools such as AWS Transform and GitHub Copilot app modernization use models, among other techniques

Failure modes

Where recipes fail

The good news is that these failures are loud. The build breaks or nothing changes, and you see it.

Senior engineer reviewChecked by hand before anything merges4 checks
  • F-01No recipe exists for your library, your in-house framework or your pattern.
  • F-02The recipe is correct for the common case and wrong for yours, for example a customized subclass.
  • F-03It changes code but not the things around it: CI images, container bases, runtime flags.
  • F-04A recipe stops partway, leaving code that does not compile.

Planning this for your estate? Get a fixed scope and price first.

Failure modes

Where LLM refactoring fails

These failures are quiet. That is why model output needs stronger gates than a recipe diff does.

  • Code that compiles and looks right but changes behavior, such as rounding, time zones or null handling.
  • APIs that do not exist in the library version you use.
  • Edits outside the scope you asked for, or tests changed to pass.
  • Different answers on a second run, so a result cannot be reproduced for audit.
  • Large codebases that do not fit the model's context, so it sees part of the picture.

Decision rule

Which one should run first?

Step 01 of 04

Is there a recipe for it?

If yes, run the recipe, for example org.openrewrite.java.migrate.UpgradeToJava21. It is cheaper to review and repeatable.

Review gates

The gates that apply to any AI-written change

These gates match the Ace8 method: test before you touch, and AI drafts while engineers decide.

  • Tests first: characterization tests written before the change, so behavior is pinned.
  • Small diffs: one slice per change, so a reviewer can read it.
  • Compile and static analysis on every change.
  • A named engineer approves every merge. The tool does not.
  • Record what tool, version and prompt produced each change.
  • Keep each step reversible, one commit per step.

Evidence

What we are measuring

We are running OpenRewrite, AWS Transform and GitHub Copilot app modernization on the same open-source Java 8, Spring Boot 2 and javax application. For each we will log files changed, compile and test results before and after, manual fixes needed, and engineer review minutes. Results will be published on the AI modernization tools benchmark page. This page states no results yet.

Next step

How Ace8 helps

Ace8 is the AI-assisted application modernization practice of AceMQ. We use recipes first, AI tools on the remainder, and engineers on every merge. See AI-assisted modernization for the full approach, or start with the assessment to find which applications fit.

FAQ

Frequently asked questions

Something else on your mind? Ask an engineer.

Using automated tools, rule-based or model-based, to restructure or update code. The word covers recipe engines and LLM tools, which behave differently.

Start here

Know the cost before anything moves.

A fixed-price assessment gives you the inventory, the risk score and a phased plan. Scope and cost are fixed before the migration starts.

  • InventoryEvery application, its stack and what it depends on.
  • Risk scoreWhere a change is likely to break, ranked.
  • Phased planWhat moves first, which tools lead, and the fixed price.

Get in touch

Talk to a modernization engineer

Tell us what you run today. An engineer, not a sales script, replies within one business day.

305-204-2607info@ace8.io

66 W. Flagler St. 9th Floor
Miami, FL 33130

What are you moving off? *

Fixed price. Scope and cost before any migration starts.