From b60121a074982af28d212207b4125030663f6df4 Mon Sep 17 00:00:00 2001 From: Neha Tarakad Date: Fri, 25 Oct 2024 16:53:00 -0700 Subject: [PATCH 1/5] adding support to accept java 17 projects --- .../feature-7d7a7670-7076-4886-affe-0d784d4bbd27.json | 4 ++++ .../services/codemodernizer/CodeModernizerManager.kt | 1 + 2 files changed, 5 insertions(+) create mode 100644 .changes/next-release/feature-7d7a7670-7076-4886-affe-0d784d4bbd27.json diff --git a/.changes/next-release/feature-7d7a7670-7076-4886-affe-0d784d4bbd27.json b/.changes/next-release/feature-7d7a7670-7076-4886-affe-0d784d4bbd27.json new file mode 100644 index 00000000000..af225359b7c --- /dev/null +++ b/.changes/next-release/feature-7d7a7670-7076-4886-affe-0d784d4bbd27.json @@ -0,0 +1,4 @@ +{ + "type" : "feature", + "description" : "Code Transform: Enable support for Java 17 projects." +} \ No newline at end of file diff --git a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/CodeModernizerManager.kt b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/CodeModernizerManager.kt index eddaa6a8788..16d799c2783 100644 --- a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/CodeModernizerManager.kt +++ b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/CodeModernizerManager.kt @@ -123,6 +123,7 @@ class CodeModernizerManager(private val project: Project) : PersistentStateCompo private val supportedJavaMappings = mapOf( JavaSdkVersion.JDK_1_8 to setOf(JavaSdkVersion.JDK_17), JavaSdkVersion.JDK_11 to setOf(JavaSdkVersion.JDK_17), + JavaSdkVersion.JDK_17 to setOf(JavaSdkVersion.JDK_17), ) init { CodeModernizerSessionState.getInstance(project).setDefaults() From cf6aa69d37ab7e9ff52c0dc25719c7f2d917a458 Mon Sep 17 00:00:00 2001 From: Neha Tarakad Date: Sat, 2 Nov 2024 18:48:24 -0700 Subject: [PATCH 2/5] confirmation of ui text received --- .../src/mynah-ui/ui/quickActions/generator.ts | 2 +- .../mynah-ui/src/mynah-ui/ui/tabs/generator.ts | 2 +- .../toolkits/resources/MessagesBundle.properties | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts index c492feeda3d..507cd5fbdde 100644 --- a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts +++ b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts @@ -37,7 +37,7 @@ export class QuickActionGenerator { ? [ { command: '/transform', - description: 'Transform your Java 8 or 11 Maven project to Java 17', + description: 'Transform your Java 8, Java 11, or Java 17 Maven projects', }, ] : []), diff --git a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts index 3f93322b918..97531009395 100644 --- a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts +++ b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts @@ -55,7 +55,7 @@ What would you like to work on?`, 'codetransform', `Welcome to Code Transformation! -I can help you upgrade your Java 8 and 11 codebases to Java 17. +I can help you upgrade your Java 8 and Java 11 codebases to Java 17, or upgrade Java 17 code with up to date libraries and other dependencies.. `, ], ]) diff --git a/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties b/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties index 595c6fe8381..dbdc6be6237 100644 --- a/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties +++ b/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties @@ -632,9 +632,9 @@ codemodernizer.chat.message.upload_failed_url_expired=Sorry, I couldn't upload y codemodernizer.chat.message.validation.check_eligible_projects=I'm checking for open projects that are eligible for Code Transformation. codemodernizer.chat.message.validation.check_passed=I can upgrade your Java module. To start the transformation, I need some information from you. Choose the module you want to upgrade and the target code version to upgrade to. Then, choose **Confirm**.\n\nIf you do not see the module you want to transform, you might need to configure your project so that I can find it. Go to File and choose Project Structure. In the Projects tab, set the correct project JDK and language level. In the Modules tab, set the correct module JDK and language level. codemodernizer.chat.message.validation.error.more_info=For more information, see the [Amazon Q documentation]({0}). -codemodernizer.chat.message.validation.error.no_pom=Sorry, I couldn't find a module that I can upgrade. I couldn't find a pom.xml file in any of your open projects. Currently, I can only upgrade Java 8 or Java 11 projects built on Maven. -codemodernizer.chat.message.validation.error.other=Sorry, I couldn't find a module that I can upgrade. Currently, I can only upgrade Java 8 or Java 11 projects built on Maven. If you have a Java 8 or Java 11 module in your workspace, you might need to configure your project so that I can find it. Go to File and choose Project Structure. In the Projects tab, set the correct project JDK and the correct language level. In the Modules tab, set the correct module JDK and language level. -codemodernizer.chat.message.validation.error.unsupported_java_version=Sorry, I couldn't find a module that I can upgrade. Currently, I can only upgrade Java 8 or Java 11 modules built on Maven. If you have a Java 8 or Java 11 module in your workspace, you might need to configure your project so that I can find it. Go to File and choose Project Structure. In the Projects tab, set the correct project JDK and the correct language level. In the Modules tab, set the correct module JDK and language level. +codemodernizer.chat.message.validation.error.no_pom=I couldn't find a module that I can upgrade. Your Java project must be built on Maven and contain a pom.xml file. For more information, see the Amazon Q documentation. +codemodernizer.chat.message.validation.error.other=I couldn't find a module that I can upgrade. Currently, I support Java 8, Java 11, and Java 17 projects built on Maven. Make sure your project is open in the IDE. If you have a Java 8, Java 11, or Java 17 module in your workspace, you might need to configure your project so that I can find it. Go to File and choose Project Structure. In the Projects tab, set the correct project JDK and the correct language level. In the Modules tab, set the correct module JDK and language level. +codemodernizer.chat.message.validation.error.unsupported_java_version=I couldn't find a module that I can upgrade. Currently, I support Java 8, Java 11, and Java 17 projects built on Maven. Make sure your project is open in the IDE. If you have a Java 8, Java 11, or Java 17 in your workspace, you might need to configure your project so that I can find it. Go to File and choose Project Structure. In the Projects tab, set the correct project JDK and the correct language level. In the Modules tab, set the correct module JDK and language level. codemodernizer.chat.message.validation.no_jdk=I couldn't build your project with your current JDK configuration. To update your JDK, go to File and choose Project Structure. In the Projects tab, set the correct project JDK in the SDK field. In the Modules tab, set the correct module JDK in the SDK field. In Maven Runner settings, set the correct JDK in the JRE field. codemodernizer.chat.prompt.label.dependency_current_version=Current version codemodernizer.chat.prompt.label.dependency_name=Dependency name @@ -709,11 +709,11 @@ codemodernizer.notification.warn.download_failed_other.content=Amazon Q ran into codemodernizer.notification.warn.download_failed_ssl.content=Please make sure all your certificates for your proxy client have been set up correctly for your IDE. codemodernizer.notification.warn.download_failed_wildcard.content=Check your IDE proxy settings and remove any wildcard (*) references, and then try viewing the diff again. codemodernizer.notification.warn.expired_credentials.title=Your connection to Q has expired -codemodernizer.notification.warn.invalid_project.description.reason.invalid_jdk_versions=None of your open modules are supported by Amazon Q Code Transformation. Currently, Amazon Q can only upgrade Java 8 or Java 11 projects built on Maven. -codemodernizer.notification.warn.invalid_project.description.reason.missing_content_roots=None of your open modules are supported by Amazon Q Code Transformation. Currently, Amazon Q can only upgrade Java 8 or Java 11 projects built on Maven. -codemodernizer.notification.warn.invalid_project.description.reason.no_valid_files=None of your open modules are supported by Amazon Q Code Transformation. Amazon Q could not find a pom.xml file in any of your open modules. Currently, Amazon Q can only upgrade Java 8 or Java 11 projects built on Maven. +codemodernizer.notification.warn.invalid_project.description.reason.invalid_jdk_versions=None of your open modules are supported for code transformation with Amazon Q. Amazon Q can upgrade Java 8, Java 11, and Java 17 projects built on Maven. +codemodernizer.notification.warn.invalid_project.description.reason.missing_content_roots=None of your open modules are supported for code transformation with Amazon Q. Amazon Q can upgrade Java 8, Java 11, and Java 17 projects built on Maven. +codemodernizer.notification.warn.invalid_project.description.reason.no_valid_files=None of your open modules are supported for code transformation with Amazon Q. A pom.xml is required for transformation. Amazon Q can upgrade Java 8, Java 11, and Java 17 projects built on Maven. codemodernizer.notification.warn.invalid_project.description.reason.not_logged_in=Amazon Q cannot start the transformation as you are not logged in with Identity Center or Builder ID. Also ensure that you are not using IntelliJ version 232.8660.185 and that you are not developing on a remote host (uncommon). -codemodernizer.notification.warn.invalid_project.description.reason.remote_backend=None of your open modules are supported by Amazon Q Code Transformation. Currently, Amazon Q can only upgrade Java 8 or Java 11 projects built on Maven, and cannot upgrade projects running on a remote host. +codemodernizer.notification.warn.invalid_project.description.reason.remote_backend=None of your open modules are supported for code transformation with Amazon Q. Amazon Q can't transform projects running on a remote host. codemodernizer.notification.warn.maven_failed.content=Amazon Q could not run the Maven clean install command to build your module. codemodernizer.notification.warn.maven_failed.title=Amazon Q Code Transform unable to zip dependencies codemodernizer.notification.warn.on_resume.unknown_status_response.content=We received data from Amazon Q in a format that the plugin cannot handle. You may need to update the plugin and then try again. From ae6d956a2fc221da3ffae708dcad49302f77b258 Mon Sep 17 00:00:00 2001 From: Neha Tarakad Date: Thu, 14 Nov 2024 10:14:41 -0800 Subject: [PATCH 3/5] fix minor text --- .../mynah-ui/src/mynah-ui/ui/quickActions/generator.ts | 2 +- plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts | 5 +---- .../aws/toolkits/resources/MessagesBundle.properties | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts index 507cd5fbdde..88b5dfd8ac3 100644 --- a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts +++ b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts @@ -37,7 +37,7 @@ export class QuickActionGenerator { ? [ { command: '/transform', - description: 'Transform your Java 8, Java 11, or Java 17 Maven projects', + description: 'Transform your Java Project', }, ] : []), diff --git a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts index 97531009395..15ff141e1bc 100644 --- a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts +++ b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts @@ -53,10 +53,7 @@ What would you like to work on?`, ], [ 'codetransform', - `Welcome to Code Transformation! - -I can help you upgrade your Java 8 and Java 11 codebases to Java 17, or upgrade Java 17 code with up to date libraries and other dependencies.. -`, + `Welcome to Code Transformation!`, ], ]) diff --git a/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties b/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties index dbdc6be6237..a47560f3b8a 100644 --- a/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties +++ b/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties @@ -713,7 +713,7 @@ codemodernizer.notification.warn.invalid_project.description.reason.invalid_jdk_ codemodernizer.notification.warn.invalid_project.description.reason.missing_content_roots=None of your open modules are supported for code transformation with Amazon Q. Amazon Q can upgrade Java 8, Java 11, and Java 17 projects built on Maven. codemodernizer.notification.warn.invalid_project.description.reason.no_valid_files=None of your open modules are supported for code transformation with Amazon Q. A pom.xml is required for transformation. Amazon Q can upgrade Java 8, Java 11, and Java 17 projects built on Maven. codemodernizer.notification.warn.invalid_project.description.reason.not_logged_in=Amazon Q cannot start the transformation as you are not logged in with Identity Center or Builder ID. Also ensure that you are not using IntelliJ version 232.8660.185 and that you are not developing on a remote host (uncommon). -codemodernizer.notification.warn.invalid_project.description.reason.remote_backend=None of your open modules are supported for code transformation with Amazon Q. Amazon Q can't transform projects running on a remote host. +codemodernizer.notification.warn.invalid_project.description.reason.remote_backend=None of your open modules are supported for code transformation with Amazon Q. Amazon Q cannot transform projects running on a remote host. codemodernizer.notification.warn.maven_failed.content=Amazon Q could not run the Maven clean install command to build your module. codemodernizer.notification.warn.maven_failed.title=Amazon Q Code Transform unable to zip dependencies codemodernizer.notification.warn.on_resume.unknown_status_response.content=We received data from Amazon Q in a format that the plugin cannot handle. You may need to update the plugin and then try again. From 485a77fb3351c86e8151e1a0bf36d0f85e65539f Mon Sep 17 00:00:00 2001 From: Neha Tarakad Date: Thu, 14 Nov 2024 11:37:41 -0800 Subject: [PATCH 4/5] fixing minor text comments --- .../amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts | 2 +- .../software/aws/toolkits/resources/MessagesBundle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts index 88b5dfd8ac3..1f62a45ce0d 100644 --- a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts +++ b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts @@ -37,7 +37,7 @@ export class QuickActionGenerator { ? [ { command: '/transform', - description: 'Transform your Java Project', + description: 'Transform your Java project', }, ] : []), diff --git a/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties b/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties index a47560f3b8a..9d7079a3732 100644 --- a/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties +++ b/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties @@ -632,7 +632,7 @@ codemodernizer.chat.message.upload_failed_url_expired=Sorry, I couldn't upload y codemodernizer.chat.message.validation.check_eligible_projects=I'm checking for open projects that are eligible for Code Transformation. codemodernizer.chat.message.validation.check_passed=I can upgrade your Java module. To start the transformation, I need some information from you. Choose the module you want to upgrade and the target code version to upgrade to. Then, choose **Confirm**.\n\nIf you do not see the module you want to transform, you might need to configure your project so that I can find it. Go to File and choose Project Structure. In the Projects tab, set the correct project JDK and language level. In the Modules tab, set the correct module JDK and language level. codemodernizer.chat.message.validation.error.more_info=For more information, see the [Amazon Q documentation]({0}). -codemodernizer.chat.message.validation.error.no_pom=I couldn't find a module that I can upgrade. Your Java project must be built on Maven and contain a pom.xml file. For more information, see the Amazon Q documentation. +codemodernizer.chat.message.validation.error.no_pom=I couldn't find a module that I can upgrade. Your Java project must be built on Maven and contain a pom.xml file. For more information, see the [Amazon Q documentation]({0}). codemodernizer.chat.message.validation.error.other=I couldn't find a module that I can upgrade. Currently, I support Java 8, Java 11, and Java 17 projects built on Maven. Make sure your project is open in the IDE. If you have a Java 8, Java 11, or Java 17 module in your workspace, you might need to configure your project so that I can find it. Go to File and choose Project Structure. In the Projects tab, set the correct project JDK and the correct language level. In the Modules tab, set the correct module JDK and language level. codemodernizer.chat.message.validation.error.unsupported_java_version=I couldn't find a module that I can upgrade. Currently, I support Java 8, Java 11, and Java 17 projects built on Maven. Make sure your project is open in the IDE. If you have a Java 8, Java 11, or Java 17 in your workspace, you might need to configure your project so that I can find it. Go to File and choose Project Structure. In the Projects tab, set the correct project JDK and the correct language level. In the Modules tab, set the correct module JDK and language level. codemodernizer.chat.message.validation.no_jdk=I couldn't build your project with your current JDK configuration. To update your JDK, go to File and choose Project Structure. In the Projects tab, set the correct project JDK in the SDK field. In the Modules tab, set the correct module JDK in the SDK field. In Maven Runner settings, set the correct JDK in the JRE field. From cdfdb84ad8d722cf7a13523c18636c6648534a77 Mon Sep 17 00:00:00 2001 From: Neha Tarakad Date: Thu, 14 Nov 2024 12:41:41 -0800 Subject: [PATCH 5/5] adding link to error message --- .../services/codemodernizer/constants/CodeTransformChatItems.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/constants/CodeTransformChatItems.kt b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/constants/CodeTransformChatItems.kt index 24494eb99a1..86f704caa8c 100644 --- a/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/constants/CodeTransformChatItems.kt +++ b/plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/constants/CodeTransformChatItems.kt @@ -189,7 +189,7 @@ fun buildProjectValidChatContent() = CodeTransformChatMessageContent( ) fun buildProjectInvalidChatContent(validationResult: ValidationResult): CodeTransformChatMessageContent { val errorMessage = when (validationResult.invalidTelemetryReason.category) { - CodeTransformPreValidationError.NoPom -> message("codemodernizer.chat.message.validation.error.no_pom") + CodeTransformPreValidationError.NoPom -> message("codemodernizer.chat.message.validation.error.no_pom", CODE_TRANSFORM_PREREQUISITES) CodeTransformPreValidationError.UnsupportedJavaVersion -> message("codemodernizer.chat.message.validation.error.unsupported_java_version") else -> message("codemodernizer.chat.message.validation.error.other") }