Upgrading Java Code with Amazon Q: A Quick Evaluation.
Introduction:?
Recently, I needed to upgrade a Java 8 codebase to Java 17 and came across a tool by Amazon Web Services (AWS) called Amazon Q. This tool claims to automate the transformation of Java 8/11 codebases to Java 17 in just 10 minutes, with larger applications taking less than an hour. You can check the claims here Upgrade Code with Gen AI - Amazon Q Developer Code Transformation - AWS.?
This blog details my observations while testing the feature and assesses the accuracy of the claims made about Amazon Q. Additionally, I encountered some limitations during my testing, which I have documented in this post.?
Setup:?
To evaluate Amazon Q's capabilities, I conducted an experiment using a public GitHub repository.?
After confirming that the application I cloned was running smoothly, I began the transformation process with Amazon Q. The setup was simple, requiring basic configurations like source and target Java versions, and the project name.??
Transformation:?
Once the transformation started, I monitored its progress in the Transformation Hub through the terminal. With around 3,800 lines of code, the process took about 40 minutes, modifying 40 files. The changes were visible in the diff section, making it easy to track what had been altered.?
During the transformation, I observed that Amazon Q added a few dependencies and plugins, upgraded library versions, and made minor modifications to some classes and methods.??
The pom.xml file, in particular, saw significant changes, with version upgrades and new dependencies. Some outdated libraries and frameworks were replaced with the latest versions.??
However, I did run into a problem: Amazon Q threw an error when dealing with the Mojo library, which was missing in the list of supported libraries or frameworks according to the official documentation. It’s essential to check the list of supported libraries before proceeding with such transformations.?
Want to check the list of supported libraries? Follow this link Supported Libraries or Frameworks.?
On the plus side, the transformation process was easy and quick. With minimal configurations, the tool handled the code upgrade without complex steps.??
?
领英推荐
Challenges:?
There were a few drawbacks. After the transformation, the application faced build errors, including version conflicts and missing plugins, which required manual fixes. Additionally, Amazon Q’s current limit of handling only 4,000 lines of code per month might be a challenge for larger applications.?
Apart from these, to evaluate the impact of the transformation on code quality, I ran a SonarQube analysis before and after the process. Below are the results:?
?
Code Analysis on Java 8 version of code.?
Code Analysis after the Code Transformation.?
As you can see, before the upgrade, there were 8 high, 9 medium, and 12 low severity issues. After the transformation, this shifted to 1 high, 13 medium, and 76 low severity issues, with issues related to renaming variables and removing commented-out lines.?
?
Conclusion:?
Overall, Amazon Q offers a promising solution for automating Java version upgrades, particularly for smaller codebases. While it doesn’t completely eliminate manual work, it significantly reduces the time and effort required for code migrations. If done manually, the upgrade process would have taken around 1 to 1.5 sprints. By using Amazon Q, we were able to save 97% of the time, significantly accelerating the task. As the tool evolves, it could become an indispensable resource for Java developers looking to upgrade to the latest version efficiently.?
Stay tuned for detailed blog on Amazon Q Code transformation. Happy Learning!!!
Oracle DBA at Version1
5 个月Excellent share Abhishek. Keeping going
Global Lead for Application Modernisation & Integration
5 个月Well done Abhishek. There are still many Java 8 apps in the wild so this has the potential to help many customers
AI/ML UKI Leader @ AWS
5 个月Great blog Abhishek! Good read :)