How the Amazon Q Developer Agent for code transformation works - Amazon Q Developer

How the Amazon Q Developer Agent for code transformation works

To transform your code, the Amazon Q Developer Agent for code transformation generates a transformation plan that it uses to upgrade the code language version of your project. After transforming your code, it provides a transformation summary and a file diff for you to review changes before accepting them. The following sections provide more details on how Amazon Q performs the transformation.

Building your code and creating a transformation plan

To begin transforming your code, Amazon Q builds your project locally and generates a build artifact that contains your source code, project dependencies, and build logs. This build artifact must be under 1 GB for Amazon Q to transform your code.

After generating the build artifact, Amazon Q builds your code in a secure build environment and creates a transformation plan, which is customized to the project or module you’re upgrading. The transformation plan outlines the specific changes Amazon Q will attempt to make, including new dependency versions, major code changes, and suggested replacements for deprecated code. These changes are based on the preliminary build of your code, and might change during the transformation.

Transforming your code

To transform your code, Amazon Q attempts to upgrade your code based on the proposed changes in the transformation plan. As it makes changes, it re-builds and runs existing unit tests in your source code to iteratively fix any encountered errors.

Amazon Q attempts to make the following changes when upgrading your code:

  • Upgrade popular libraries and frameworks to a version compatible with Java 17. This includes updating Spring, Spring Boot, Junit, JakartaEE, Mockito, Hibernate, and Log4j to their latest available major versions.

  • Update deprecated code components according to Java 17 recommendations

Reviewing the transformation summary and accepting changes

After the transformation is complete, Amazon Q provides a transformation summary with details about the changes it made, including the status of the final build which indicates whether your entire project was upgraded. You can also view a build log summary to understand any issues that prevented Amazon Q from building your code in the upgraded version.

The transformation summary additionally includes the differences between the changes proposed in the transformation plan and the changes Amazon Q ultimately made to upgrade your code, and any additional changes that weren’t in the original plan.

After you review the transformation summary, you can view the changes Amazon Q is proposing in a file diff view. Any code changes Amazon Q suggests will not affect your current project files until you accept the changes. The transformed code is available up to 24 hours after the transformation completes.