Skip to content

Commit

Permalink
feat: add java v 21 support for apex lsp (#5621)
Browse files Browse the repository at this point in the history
* feat: add java v 21 support for apex lsp

@W-14486693@

Add support for java 21

* chore: update messages for wrong java version

* chore: git ignore tsconfig.tsbuildinfo files
  • Loading branch information
peternhale authored Jun 4, 2024
1 parent 2e0d5b2 commit 47df0a8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,5 @@ packages/dbaeumer*
.history

# Extension build directory
packages/**/extension
packages/**/extension
tsconfig.tsbuildinfo
2 changes: 1 addition & 1 deletion packages/salesforcedx-vscode-apex/src/messages/i18n.ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const messages = {
source_missing_text:
'指定されたフォルダ %s は存在しません。Salesforce Apex 拡張機能の設定方法についての詳細は、[Java 設定](%s) を参照してください。',
wrong_java_version_text:
'サポートされていない 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) を参照してください。',
'サポートされていない 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 21](https://www.oracle.com/java/technologies/downloads/#java21) をダウンロードし、インストールしてください。詳細については、[Java バージョンを設定する](%s) を参照してください。',
apex_test_suite_build_text: 'SFDX: Apex テストスイートを作成',
unable_to_locate_editor:
'ソースファイルに対してのみこのコマンドを実行できます。',
Expand Down
2 changes: 1 addition & 1 deletion packages/salesforcedx-vscode-apex/src/messages/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ 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 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), [Java 17](https://www.oracle.com/java/technologies/downloads/#java17) or [Java 21](https://www.oracle.com/java/technologies/downloads/#java21) to run the extensions. For more information, see [Set Your Java Version](%s).',
wrong_java_version_short: 'Unsupported Java version',
java_version_check_command_failed:
'Running java command %s failed with error: %s',
Expand Down
2 changes: 1 addition & 1 deletion packages/salesforcedx-vscode-apex/src/requirements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const checkJavaVersion = async (javaHome: string): Promise<boolean> => {
)
);
}
if (!/java\.version\s*=\s*(?:11|17)/g.test(stderr)) {
if (!/java\.version\s*=\s*(?:11|17|21)/g.test(stderr)) {
reject(nls.localize('wrong_java_version_text', SET_JAVA_DOC_LINK));
} else {
resolve(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ describe('Java Requirements Test', () => {
}
});

it('Should support Java 21', async () => {
execFileStub.yields('', '', 'java.version = 21.0.0');
try {
const result = await checkJavaVersion('~/java_home');
expect(result).to.equal(true);
} catch (err) {
fail(
`Should not have thrown when the Java version is 21. The error was: ${err}`
);
}

});
it('Should not support Java 20', async () => {
execFileStub.yields('', '', 'java.version = 20.0.0');
try {
Expand Down

0 comments on commit 47df0a8

Please sign in to comment.