From 5f4474631070c811586fd55a2a3d5e4f228cd95d Mon Sep 17 00:00:00 2001 From: peternhale Date: Tue, 19 Sep 2023 11:53:12 -0600 Subject: [PATCH] fix: remove support for java 8 (#5078) * fix: remove support for java 8 @W-14067954@ remove support for java 8 update messages and extension config * chore: fix build (#5080) * docs: einstein for developers (#5053) * docs: einstien for developers first commit * docs: japanese files and sidebar commit 2 * docs: fix sidebar fixed filename * Update sidebar.yml * docs: some more doc updates new side bar screenshots and text * Update einstein-apex.md * docs: apex update * Update einstein-apex.md * docs: sample code topic fixed formatting * Update einstein-example-prompts.md commiting again because changes disappeared. * Update einstein-setup.md redoing missing commit. * Update einstein-setup.md * Update einstein-setup.md * docs: new sidebar image * Update einstein-setup.md * Update einstein-setup.md * Update einstein-setup.md * Update einstein-setup.md updated image * docs: new image * docs: update side bar images * docs: bunch of updates edits and such * Update einstein-setup.md * docs: pm feedback * docs: setup page update * Update einstein-setup.md giving up on buttons. * Update einstein-overview.md added subsection * Update einstein-setup.md removed (beta) * Update einstein-telemetry.md * Update einstein-example-prompts.md * Update einstein-overview.md from acrolinx * Update einstein-setup.md acrolinx suggests * Update einstein-overview.md * Update java-setup.md Java 8 update -- removed mention * Update install.md removed mention of Java 8 and added "17 or later". * Update einstein-setup.md * docs: setup and codegen desc update * docs: beta terms of use and code builder setup * Update einstein-setup.md * Update einstein-setup.md extension marketplace link * Update einstein-setup.md * Update recommended-extensions.md Added a new link for Salesforce Code Analyzer. * Update recommended-extensions.md * Update einstein-setup.md numbering won't take. * Update einstein-setup.md added more steps to the scratch org creation section. * Update einstein-setup.md * Update einstein-setup.md * Update docs/_articles/en/einstein/einstein-apex.md Co-authored-by: AnanyaJha * docs: einstein in a scratch org update * docs: prompt examples * docs: trailblazer group added information about trailblazer group. * Update einstein-setup.md * Update einstein-setup.md enhanced domains enablement * Update einstein-setup.md got rid of funky numbering issues. * Update einstein-telemetry.md * Update einstein-feedback.md removed references to pilot * Update einstein-troubleshoot.md * Update einstein-glossary.md * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update docs/_articles/en/vscode-desktop/recommended-extensions.md Co-authored-by: Martha Morgan * Update sidebar.yml * Update docs/_articles/en/einstein/einstein-apex.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-apex.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-apex.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-apex.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-apex.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-apex.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-apex.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-apex.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-apex.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-example-prompts.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-example-prompts.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-example-prompts.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-example-prompts.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-example-prompts.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-example-prompts.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-faq.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-faq.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-glossary.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-faq.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-faq.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-faq.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-example-prompts.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-apex.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-example-prompts.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-example-prompts.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-example-prompts.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-apex.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-apex.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-glossary.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-glossary.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-glossary.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-glossary.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-glossary.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-glossary.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-setup.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-glossary.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-setup.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-glossary.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update einstein-example-prompts.md * Update docs/_articles/en/einstein/einstein-setup.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-setup.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-setup.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-setup.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-setup.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-setup.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-setup.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-setup.md Co-authored-by: Martha Morgan * Update docs/_articles/en/einstein/einstein-overview.md Co-authored-by: Martha Morgan * Update einstein-apex.md * Update einstein-example-prompts.md * Update einstein-glossary.md * Update einstein-glossary.md * Update einstein-setup.md * Update einstein-overview.md * Update einstein-overview.md --------- Co-authored-by: AnanyaJha Co-authored-by: Martha Morgan * chore: fix test --------- Co-authored-by: Ritam Agrawal <72183558+RitamAgrawal@users.noreply.github.com> Co-authored-by: Sonal Budhiraja <57969266+sbudhirajadoc@users.noreply.github.com> Co-authored-by: AnanyaJha Co-authored-by: Martha Morgan --- packages/salesforcedx-vscode-apex/package.nls.json | 2 +- packages/salesforcedx-vscode-apex/src/index.ts | 11 +++++++---- .../salesforcedx-vscode-apex/src/messages/i18n.ja.ts | 2 +- .../salesforcedx-vscode-apex/src/messages/i18n.ts | 7 +++++-- .../salesforcedx-vscode-apex/src/requirements.ts | 1 - .../languageUtils}/languageClientUtils.test.ts | 0 .../test/vscode-integration/requirements.test.ts | 12 ++++++------ 7 files changed, 20 insertions(+), 15 deletions(-) rename packages/salesforcedx-vscode-apex/test/{vscode-integration/languageClientUtils => jest/languageUtils}/languageClientUtils.test.ts (100%) diff --git a/packages/salesforcedx-vscode-apex/package.nls.json b/packages/salesforcedx-vscode-apex/package.nls.json index 65ff85d2f9..635b73f52d 100644 --- a/packages/salesforcedx-vscode-apex/package.nls.json +++ b/packages/salesforcedx-vscode-apex/package.nls.json @@ -7,7 +7,7 @@ "run_single_test_title": "Run Single Test", "show_error_title": "Display Error", "go_to_definition_title": "Go to Definition", - "java_home_description": "Specifies the folder path to the Java 8, Java 11, or Java 17 runtime used to launch the Apex Language Server (for example, /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home).", + "java_home_description": "Specifies the folder path to the Java 11, or Java 17 runtime used to launch the Apex Language Server (for example, /Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home).", "java_memory_description": "Specifies the amount of memory allocation to the Apex Language Server in MB, or null to use the system default value.", "apex_semantic_errors_description": "Allow Apex Language Server to surface semantic errors", "force_anon_apex_execute_document_text": "SFDX: Execute Anonymous Apex with Editor Contents", diff --git a/packages/salesforcedx-vscode-apex/src/index.ts b/packages/salesforcedx-vscode-apex/src/index.ts index 21751e544b..fbf42cef00 100644 --- a/packages/salesforcedx-vscode-apex/src/index.ts +++ b/packages/salesforcedx-vscode-apex/src/index.ts @@ -28,7 +28,7 @@ import { forceApexTestSuiteRun, forceLaunchApexReplayDebuggerWithCurrentFile } from './commands'; -import { APEX_EXTENSION_NAME, LSP_ERR } from './constants'; +import { APEX_EXTENSION_NAME, LSP_ERR, SET_JAVA_DOC_LINK } from './constants'; import { workspaceContext } from './context'; import { ClientStatus, @@ -326,8 +326,12 @@ async function createLanguageClient(extensionContext: vscode.ExtensionContext) { extensionContext.subscriptions.push(handle); } catch (e) { languageClientUtils.setStatus(ClientStatus.Error, e); + let eMsg = typeof e === 'string' ? e : e.message ?? nls.localize('unknown_error'); + if (eMsg.includes(nls.localize('wrong_java_version_text', SET_JAVA_DOC_LINK))) { + eMsg = nls.localize('wrong_java_version_short'); + } languageServerStatusBarItem.error( - `${nls.localize('apex_language_server_failed_activate')} - ${e.message}` + `${nls.localize('apex_language_server_failed_activate')} - ${eMsg}` ); } } @@ -361,8 +365,7 @@ function addOnReadyHandlerToLanguageClient( nls.localize('apex_language_server_failed_activate') ); languageServerStatusBarItem.error( - `${nls.localize('apex_language_server_failed_activate')} - ${ - err.message + `${nls.localize('apex_language_server_failed_activate')} - ${err.message }` ); }); diff --git a/packages/salesforcedx-vscode-apex/src/messages/i18n.ja.ts b/packages/salesforcedx-vscode-apex/src/messages/i18n.ja.ts index 2f9f30b24d..c35610e748 100644 --- a/packages/salesforcedx-vscode-apex/src/messages/i18n.ja.ts +++ b/packages/salesforcedx-vscode-apex/src/messages/i18n.ja.ts @@ -75,7 +75,7 @@ export const messages = { source_missing_text: '指定されたフォルダ %s は存在しません。Salesforce Apex 拡張機能の設定方法についての詳細は、[Java 設定](%s) を参照してください。', wrong_java_version_text: - 'サポートされていない Java のバージョンが検出されました。拡張機能を実行するには、[Java 8](https://java.com/en/download/)、[Java 11](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html)、または [Java 17](https://www.oracle.com/java/technologies/downloads/#java17) をダウンロードし、インストールしてください。詳細については、[Java バージョンを設定する](%s) を参照してください。', + 'サポートされていない Java のバージョンが検出されました。拡張機能を実行するには、[Java 11](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html)、または [Java 17](https://www.oracle.com/java/technologies/downloads/#java17) をダウンロードし、インストールしてください。詳細については、[Java バージョンを設定する](%s) を参照してください。', force_apex_test_suite_build_text: 'SFDX: Apex テストスイートを作成', unable_to_locate_editor: 'ソースファイルに対してのみこのコマンドを実行できます。', diff --git a/packages/salesforcedx-vscode-apex/src/messages/i18n.ts b/packages/salesforcedx-vscode-apex/src/messages/i18n.ts index 953884f8bc..f35fd93e53 100644 --- a/packages/salesforcedx-vscode-apex/src/messages/i18n.ts +++ b/packages/salesforcedx-vscode-apex/src/messages/i18n.ts @@ -77,10 +77,13 @@ export const messages = { source_missing_text: '%s points to a missing folder. For information on how to setup the Salesforce Apex extension, see [Set Your Java Version](%s).', wrong_java_version_text: - 'An unsupported Java version was detected. Download and install [Java 8](https://java.com/en/download/), [Java 11](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html), or [Java 17](https://www.oracle.com/java/technologies/downloads/#java17) to run the extensions. For more information, see [Set Your Java Version](%s).', + 'An unsupported Java version was detected. Download and install [Java 11](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html), or [Java 17](https://www.oracle.com/java/technologies/downloads/#java17) to run the extensions. For more information, see [Set Your Java Version](%s).', + wrong_java_version_short: + 'Unsupported Java version', force_apex_test_suite_build_text: 'SFDX: Build Apex Test Suite', unable_to_locate_editor: 'You can run this command only on a source file.', unable_to_locate_document: 'You can run this command only on a source file.', launch_apex_replay_debugger_unsupported_file: - 'You can only run this command with Anonymous Apex files, Apex Test files, or Apex Debug Log files.' + 'You can only run this command with Anonymous Apex files, Apex Test files, or Apex Debug Log files.', + unknown_error: 'Unknown error' }; diff --git a/packages/salesforcedx-vscode-apex/src/requirements.ts b/packages/salesforcedx-vscode-apex/src/requirements.ts index 865388ed38..e96c9e44bd 100644 --- a/packages/salesforcedx-vscode-apex/src/requirements.ts +++ b/packages/salesforcedx-vscode-apex/src/requirements.ts @@ -108,7 +108,6 @@ export function checkJavaVersion(javaHome: string): Promise { {}, (error, stdout, stderr) => { if ( - stderr.indexOf('build 1.8') < 0 && stderr.indexOf('build 11.') < 0 && stderr.indexOf('build 17.') < 0 ) { diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/languageClientUtils/languageClientUtils.test.ts b/packages/salesforcedx-vscode-apex/test/jest/languageUtils/languageClientUtils.test.ts similarity index 100% rename from packages/salesforcedx-vscode-apex/test/vscode-integration/languageClientUtils/languageClientUtils.test.ts rename to packages/salesforcedx-vscode-apex/test/jest/languageUtils/languageClientUtils.test.ts diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/requirements.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/requirements.test.ts index c872ef85f9..e6936532ba 100644 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/requirements.test.ts +++ b/packages/salesforcedx-vscode-apex/test/vscode-integration/requirements.test.ts @@ -62,19 +62,19 @@ describe('Java Requirements Test', () => { it('Should allow valid java runtime path outside the project', async () => { settingStub.withArgs(JAVA_HOME_KEY).returns(runtimePath); - execFileStub.yields('', '', 'build 1.8'); + execFileStub.yields('', '', 'build 11.0.0'); const requirements = await resolveRequirements(); expect(requirements.java_home).contains(jdk); }); - it('Should support Java 8', async () => { + it('Should not support Java 8', async () => { execFileStub.yields('', '', 'build 1.8.0'); try { - const result = await checkJavaVersion('~/java_home'); - expect(result).to.equal(true); + await checkJavaVersion('~/java_home'); + fail('Should have thrown when the Java version is not supported'); } catch (err) { - fail( - `Should not have thrown when the Java version is 17. The error was: ${err}` + expect(err).to.equal( + nls.localize('wrong_java_version_text', SET_JAVA_DOC_LINK) ); } });