From 562988c11a4bc0dd47949e1f06f4d9b28c6de3dc Mon Sep 17 00:00:00 2001 From: lick <2188718831@qq.com> Date: Mon, 16 Nov 2026 23:30:35 -0800 Subject: [PATCH] =?UTF-8?q?fix(java):=20=E6=94=B9=E8=BF=9B=20jdtls-runtime?= =?UTF-8?q?=20=E5=8F=91=E7=8E=B0=E4=B8=8E=20JDT=20LS=20=E6=89=80=E9=9C=80?= =?UTF-8?q?=20Java=20=E7=89=88=E6=9C=AC=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +- backend/src/jdtls.rs | 201 +++++++++++++++++- backend/src/launch.rs | 91 +++++++- backend/tests/repository_pins.rs | 51 ++++- docs/feature-matrix.md | 2 +- io.github.lithe-idea.java-support/plugin.json | 14 +- 6 files changed, 343 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 8004e3a..331ec9f 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,7 @@ Spring/MyBatis 等既有能力不属于本轮 Maven 验收范围。 插件包不带 JDT LS,也不带运行它的 JDK,和 Go 插件使用你自己的 `gopls` 一样。需要: -1. **Eclipse JDT Language Server**。按以下顺序找,用第一个: +1. **Eclipse JDT Language Server**。按以下顺序找,优先使用当前 `jdtls-runtime` 可满足其最低 Java 版本要求的安装;若都不满足则落到第一个并报出该安装所需的最低 Java 版本: 1. 设置 → 语言与框架 → Java →「语言服务器目录」。选了目录就只用它,目录里没有 JDT LS 时直接报错,不会退回别的安装; 2. 环境变量 `JDTLS_HOME`; 3. `PATH` 上的 `jdtls` 启动脚本所属的安装(沿符号链接找到真实目录); @@ -207,9 +207,9 @@ Spring/MyBatis 等既有能力不属于本轮 Maven 验收范围。 `config_<平台>/config.ini`。安装方式举例:macOS / Linux 用 `brew install jdtls`;也可以从 [download.eclipse.org/jdtls](https://download.eclipse.org/jdtls/milestones/) 下载解压,再在设置里选目录。 已测试 JDT LS 1.61.0(CI 固定,见 `third_party/jdtls/manifest.json`)和 Homebrew 1.60.0。 -2. **JDK 21 或更新版本**,用来运行 JDT LS。它是插件新增的「JDK for JDT LS」工具(`jdtls-runtime`), - 在设置 → 构建、执行、部署 → 工具链里显示和选择;没选时依次用登录 shell 的 `java` 和找到的最高版本 JDK。 - 宿主报告的版本低于 21 时,启动直接报错并提示去工具链里选择。项目自己的 JDK 是原来的「JDK」工具(`java`),两者互不影响。 +2. **满足目标 JDT LS 要求的 JDK(至少 JDK 21;JDT LS 1.63+ 要求 JDK 25)**,用来运行 JDT LS。它是插件新增的「JDK for JDT LS」工具(`jdtls-runtime`), + 在设置 → 构建、执行、部署 → 工具链里显示和选择;没选时依次用登录 shell 的 `java`(仅匹配 21 及更新版本,跳过 `PATH` 上的 Java 8/11/17)和找到的最高版本 JDK(含系统 JDK 目录与 VS Code / Cursor `redhat.java` 扩展自带的 `jre/`)。 + 后端会从目标 JDT LS 核心 bundle 的 `MANIFEST.MF`(`Bundle-RequiredExecutionEnvironment`)读取实际最低 Java 版本,低于该版本时启动直接报错并提示去工具链里选择。项目自己的 JDK 是原来的「JDK」工具(`java`),两者互不影响。 JDT 只能为它支持的 Java 版本编译:没有为项目选 JDK 时,JDT 用运行它的 JDK 编译,这个 JDK 比 JDT LS 支持的最新 Java 还新时编译会报错。 找不到 JDT LS 时,语言服务启动失败(`launch.server_missing`),错误信息说明如何安装或去哪里设置。 @@ -245,7 +245,7 @@ Spring/MyBatis 等既有能力不属于本轮 Maven 验收范围。 | 其余函数成功(编辑器驱动或启动时的读取,如 `java.runMarkers`、`java.codeVision`、`spring.index`) | 不记录 | `suppress_success_diagnostics`(`backend/src/lib.rs`) | — | | 任一函数失败 | ERROR | SDK 自动 | 类别为 `pluginErrorCode`(如 `java.invalidRequest`;`languageImport.settingsChanged` 的 `relay.caller_missing`、`relay.context_missing`、`relay.invalid_params`)、耗时;不含消息与 `details` | | 领域命令失败类别 | ERROR | `plugin_error_code` | `java.invalidRequest`、`java.workspaceNotFound`、`java.permissionDenied`、`java.notSupported`、`java.runtimeMissing`、`java.processStartFailed`、`java.processFailed`、`java.parseFailed`、`java.cancelled`、`java.timedOut`、`java.connectionClosed`、`java.unknown`;SDK 识别的取消不记录 | -| JDT 启动规划失败 | ERROR | SDK 自动 | `launch.invalid_params`、`launch.package_unavailable`、`launch.resource_missing`、`launch.configuration_failed`、`launch.server_missing`(找不到 JDT LS)、`launch.server_invalid`(设置的目录不是 JDT LS)、`launch.runtime_too_old`(运行 JDT LS 的 JDK 低于 21) | +| JDT 启动规划失败 | ERROR | SDK 自动 | `launch.invalid_params`、`launch.package_unavailable`、`launch.resource_missing`、`launch.configuration_failed`、`launch.server_missing`(找不到 JDT LS)、`launch.server_invalid`(设置的目录不是 JDT LS)、`launch.runtime_too_old`(运行 JDT LS 的 JDK 低于目标 JDT LS 要求的最低版本,至少 21) | | JDT 配置清理或工作区读取降级 | WARN | SDK `degraded` | `launch.configuration_cleanup_failed`、`launch.workspace_folders_unavailable` | | 取消 | 不记录 | SDK | — | | 列出 `languageImport.settings` 提供方失败、单个提供方失败或超时、答复不可用、答复含越界键、提供方导出的函数版本不符 | WARN(`degraded`) | `backend/src/plugin_functions.rs` | 类别 `relay.providers_unavailable`、`relay.provider_failed`、`relay.provider_timed_out`、`relay.settings_rejected`、`relay.keys_rejected`、`relay.provider_version_mismatch`,计数;不含提供方 ID | diff --git a/backend/src/jdtls.rs b/backend/src/jdtls.rs index 0ff00cf..e39c9d2 100644 --- a/backend/src/jdtls.rs +++ b/backend/src/jdtls.rs @@ -30,8 +30,22 @@ use lithe_plugin_sdk::PluginError; use std::ffi::OsString; -use std::fs; +use std::fs::{self, File}; +use std::io::Read; use std::path::{Path, PathBuf}; +use zip::ZipArchive; + +/// Oldest Java feature release any JDT LS installation runs on. +pub const DEFAULT_MINIMUM_JAVA_VERSION: u64 = 21; +/// Core OSGi bundles whose `META-INF/MANIFEST.MF` declares the Java release +/// an installation requires (for example `JavaSE-25` in JDT LS 1.63+). +const CORE_RUNTIME_BUNDLE_PREFIXES: &[&str] = &[ + "org.eclipse.jdt.ls.core_", + "org.eclipse.jdt.core_", + "org.eclipse.core.resources_", + "org.eclipse.core.filesystem_", + "org.eclipse.equinox.common_", +]; /// No JDT LS installation was found on the machine. pub const LAUNCH_SERVER_MISSING: &str = "launch.server_missing"; @@ -95,6 +109,9 @@ pub struct ServerInstallation { /// The read-only Equinox configuration of the platform; the launch uses a /// writable copy of it. pub configuration: PathBuf, + /// Oldest Java feature release the bundles of this installation require, + /// at least [`DEFAULT_MINIMUM_JAVA_VERSION`]. + pub minimum_java_version: u64, } /// What [`locate`] reads from the backend's process environment, so tests @@ -156,18 +173,88 @@ fn installation_at(home: &Path, configuration: &str) -> Option u64 { + let Ok(entries) = fs::read_dir(plugins) else { + return DEFAULT_MINIMUM_JAVA_VERSION; + }; + entries + .filter_map(Result::ok) + .filter_map(|entry| { + let path = entry.path(); + let name = path.file_name()?.to_str()?; + if !name.ends_with(".jar") + || !CORE_RUNTIME_BUNDLE_PREFIXES + .iter() + .any(|prefix| name.starts_with(prefix)) + { + return None; + } + bundle_java_version(&path) + }) + .fold(DEFAULT_MINIMUM_JAVA_VERSION, u64::max) +} + +fn bundle_java_version(jar_path: &Path) -> Option { + let file = File::open(jar_path).ok()?; + let mut archive = ZipArchive::new(file).ok()?; + let entry = archive.by_name("META-INF/MANIFEST.MF").ok()?; + let mut manifest = String::new(); + entry.take(256 * 1024).read_to_string(&mut manifest).ok()?; + manifest_java_version(&manifest) +} + +/// Extracts the highest Java feature version declared in an OSGi +/// `META-INF/MANIFEST.MF` (`Bundle-RequiredExecutionEnvironment: JavaSE-25` or +/// `Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=25))"`). +pub fn manifest_java_version(manifest: &str) -> Option { + let unfolded = manifest.replace("\r\n ", "").replace("\n ", ""); + let mut highest = None; + for line in unfolded.lines() { + let trimmed = line.trim(); + if !trimmed.starts_with("Bundle-RequiredExecutionEnvironment:") + && !trimmed.starts_with("Require-Capability:") + { + continue; + } + for marker in ["JavaSE-", "(version="] { + let mut rest = trimmed; + while let Some(index) = rest.find(marker) { + rest = &rest[index + marker.len()..]; + let digits: String = rest + .chars() + .take_while(|character| character.is_ascii_digit()) + .collect(); + // `JavaSE-1.8` has a dot after `1`; only feature releases >= 9 count. + if rest.as_bytes().get(digits.len()) == Some(&b'.') && digits == "1" { + continue; + } + if let Ok(version) = digits.parse::() { + highest = Some(highest.map_or(version, |current: u64| current.max(version))); + } + } + } + } + highest +} + /// The one Equinox launcher JAR in `directory`. None or several mean the /// folder is no usable installation. fn launcher_in(directory: &Path) -> Option { @@ -199,6 +286,21 @@ pub fn locate( environment: &SearchEnvironment, os: &str, arch: &str, +) -> Result { + locate_for_runtime(configured, environment, os, arch, None) +} + +/// Finds the JDT LS installation for `os` and `arch`, preferring a discovered +/// installation whose required Java release is at most `runtime_java_version` +/// when `configured` is `None`. When no discovered installation can run on +/// `runtime_java_version`, the first installation found is returned so the +/// caller reports the Java version that installation requires. +pub fn locate_for_runtime( + configured: Option<&Path>, + environment: &SearchEnvironment, + os: &str, + arch: &str, + runtime_java_version: Option, ) -> Result { let configuration = configuration_name(os, arch) .ok_or_else(|| PluginError::new(LAUNCH_SERVER_MISSING, SERVER_MISSING_MESSAGE))?; @@ -206,10 +308,19 @@ pub fn locate( return inspect(folder, configuration) .ok_or_else(|| PluginError::new(LAUNCH_SERVER_INVALID, SERVER_INVALID_MESSAGE)); } - candidates(environment, os) - .iter() - .find_map(|folder| inspect(folder, configuration)) - .ok_or_else(|| PluginError::new(LAUNCH_SERVER_MISSING, SERVER_MISSING_MESSAGE)) + let mut first = None; + for folder in candidates(environment, os) { + let Some(installation) = inspect(&folder, configuration) else { + continue; + }; + if runtime_java_version.is_none_or(|feature| installation.minimum_java_version <= feature) { + return Ok(installation); + } + if first.is_none() { + first = Some(installation); + } + } + first.ok_or_else(|| PluginError::new(LAUNCH_SERVER_MISSING, SERVER_MISSING_MESSAGE)) } /// The folders [`locate`] tries without a configured one, in order. A folder @@ -511,4 +622,82 @@ mod tests { assert!(folders.contains(&temp.0.join("scoop/apps/jdtls/current"))); assert!(!folders.contains(&PathBuf::from("/opt/homebrew/opt/jdtls"))); } + + fn write_bundle_manifest(jar_path: &Path, manifest: &str) { + use std::io::Write; + let file = File::create(jar_path).unwrap(); + let mut zip = zip::ZipWriter::new(file); + zip.start_file( + "META-INF/MANIFEST.MF", + zip::write::SimpleFileOptions::default(), + ) + .unwrap(); + zip.write_all(manifest.as_bytes()).unwrap(); + zip.finish().unwrap(); + } + + #[test] + fn bundle_manifests_report_the_java_release_the_installation_requires() { + assert_eq!( + manifest_java_version( + "Manifest-Version: 1.0\r\nBundle-RequiredExecutionEnvironment: JavaSE-1.8\r\n" + ), + None + ); + assert_eq!( + manifest_java_version( + "Manifest-Version: 1.0\r\nBundle-RequiredExecutionEnvironment: JavaSE-25\r\n" + ), + Some(25) + ); + assert_eq!( + manifest_java_version( + "Require-Capability: osgi.ee;filter:=\"(&(osgi.ee=JavaSE)(version=\r\n 21))\"\r\n" + ), + Some(21) + ); + + let temp = TempDir::new(); + let modern = temp.0.join(".vscode/extensions/redhat.java-1.58.0/server"); + install(&modern, &["config_win"]); + write_bundle_manifest( + &modern.join("plugins/org.eclipse.core.filesystem_1.12.0.jar"), + "Manifest-Version: 1.0\nBundle-RequiredExecutionEnvironment: JavaSE-25\n", + ); + let legacy = temp.0.join(".vscode/extensions/redhat.java-1.47.0/server"); + install(&legacy, &["config_win"]); + write_bundle_manifest( + &legacy.join("plugins/org.eclipse.jdt.ls.core_1.61.0.jar"), + "Manifest-Version: 1.0\nRequire-Capability: osgi.ee;filter:=\"(&(osgi.ee=JavaSE)(version=21))\"\n", + ); + + assert_eq!( + inspect(&modern, "config_win").unwrap().minimum_java_version, + 25 + ); + assert_eq!( + inspect(&legacy, "config_win").unwrap().minimum_java_version, + 21 + ); + + // On JDK 21, automatic discovery skips the Java-25 server and picks + // the Java-21 server; on JDK 25, the newest server wins; on JDK 17, + // the first installation is returned so the caller reports its requirement. + let search = environment(&temp.0); + assert_eq!( + locate_for_runtime(None, &search, "windows", "x86_64", Some(21)) + .unwrap() + .home, + legacy + ); + assert_eq!( + locate_for_runtime(None, &search, "windows", "x86_64", Some(25)) + .unwrap() + .home, + modern + ); + let fallback = locate_for_runtime(None, &search, "windows", "x86_64", Some(17)).unwrap(); + assert_eq!(fallback.home, modern); + assert_eq!(fallback.minimum_java_version, 25); + } } diff --git a/backend/src/launch.rs b/backend/src/launch.rs index a54e128..7048842 100644 --- a/backend/src/launch.rs +++ b/backend/src/launch.rs @@ -105,7 +105,7 @@ pub const LAUNCH_ERROR_CODES: &[&str] = &[ pub const SERVER_RUNTIME_TOOL: &str = "jdtls-runtime"; /// Oldest Java feature release JDT LS runs on. pub const MINIMUM_SERVER_JAVA_VERSION: u64 = 21; -/// Message of [`LAUNCH_RUNTIME_TOO_OLD`]. +/// Message of [`LAUNCH_RUNTIME_TOO_OLD`] for [`MINIMUM_SERVER_JAVA_VERSION`]. /// /// TODO(host-api: API-37 i18n): user-facing text must go through the host's /// i18n table. @@ -113,6 +113,17 @@ pub const RUNTIME_TOO_OLD_MESSAGE: &str = "The Eclipse JDT Language Server needs later, but the JDK chosen for it is older. Choose a JDK 21 or later for \"JDK for JDT LS\" in \ Settings > Build, Execution, Deployment > Toolchains."; +/// Message of [`LAUNCH_RUNTIME_TOO_OLD`] for the Java feature release +/// `minimum_java_version` the selected JDT LS installation requires. +pub fn runtime_too_old_message(minimum_java_version: u64) -> String { + let minimum = minimum_java_version.max(MINIMUM_SERVER_JAVA_VERSION); + format!( + "The Eclipse JDT Language Server needs Java {minimum} or later, but the JDK chosen for \ +it is older. Choose a JDK {minimum} or later for \"JDK for JDT LS\" in Settings > Build, \ +Execution, Deployment > Toolchains." + ) +} + /// Configuration areas of older JDT LS versions could not be removed. Only /// disk space is at stake, so the launch goes on. pub const LAUNCH_CONFIGURATION_CLEANUP_FAILED: &str = "launch.configuration_cleanup_failed"; @@ -349,19 +360,33 @@ fn host_tool_version(params: &Value, tool: &str) -> Option { .map(str::to_string) } +/// The Java feature release of `request.server_runtime_version`, when readable. +pub fn server_runtime_feature(request: &LaunchRequest) -> Option { + request + .server_runtime_version + .as_deref() + .and_then(|version| version.split(['.', '_', '+', '-']).next()) + .and_then(|feature| feature.parse::().ok()) +} + /// Refuses a JDT LS runtime the host reported as older than /// [`MINIMUM_SERVER_JAVA_VERSION`]. A runtime without a readable version is /// left to the host and to JDT LS, which reports what it cannot run on. pub fn check_server_runtime(request: &LaunchRequest) -> Result<(), PluginError> { - let feature = request - .server_runtime_version - .as_deref() - .and_then(|version| version.split(['.', '_', '+', '-']).next()) - .and_then(|feature| feature.parse::().ok()); - match feature { - Some(feature) if feature < MINIMUM_SERVER_JAVA_VERSION => Err(PluginError::new( + check_server_runtime_for(request, MINIMUM_SERVER_JAVA_VERSION) +} + +/// Refuses a JDT LS runtime the host reported as older than +/// `minimum_java_version` (floored at [`MINIMUM_SERVER_JAVA_VERSION`]). +pub fn check_server_runtime_for( + request: &LaunchRequest, + minimum_java_version: u64, +) -> Result<(), PluginError> { + let minimum = minimum_java_version.max(MINIMUM_SERVER_JAVA_VERSION); + match server_runtime_feature(request) { + Some(feature) if feature < minimum => Err(PluginError::new( LAUNCH_RUNTIME_TOO_OLD, - RUNTIME_TOO_OLD_MESSAGE, + runtime_too_old_message(minimum), )), _ => Ok(()), } @@ -538,7 +563,7 @@ pub fn resolve( now_unix_seconds: u64, report: &dyn Fn(&str, u64), ) -> Result { - check_server_runtime(request)?; + check_server_runtime_for(request, server.minimum_java_version)?; let files = locate_launch_files(package_root, server)?; let area = prepare_jdt_configuration_area( &request.state_directory, @@ -701,11 +726,12 @@ pub fn resolve_launch_function( context.check_cancelled()?; let request = parse_launch_params(¶ms)?; check_server_runtime(&request)?; - let server = jdtls::locate( + let server = jdtls::locate_for_runtime( request.server_home.as_deref(), &SearchEnvironment::current(), &request.os, &request.architecture, + server_runtime_feature(&request), )?; let package_root = package_root()?; let diagnostics = context.diagnostics(); @@ -1211,6 +1237,49 @@ mod tests { // Without a version the host's own resolution decides. params["tools"] = json!({}); assert!(check_server_runtime(&parse_launch_params(¶ms).unwrap()).is_ok()); + + // A JDT LS installation whose core bundles require Java 25 (such as + // JDT LS 1.63+) refuses a Java 21 runtime with the exact required + // version before writing anything to `state`. + let mut server_25 = fixture.server(); + server_25.minimum_java_version = 25; + params["tools"] = json!({ + "jdtls-runtime": {"executable": "/jdk21/bin/java", "home": "/jdk21", "version": "21.0.9"} + }); + let request_21 = parse_launch_params(¶ms).unwrap(); + let report = |_: &str, _: u64| {}; + let error = resolve( + &request_21, + &server_25, + &fixture.package(), + &[], + &[], + 1_000_000, + &report, + ) + .unwrap_err(); + assert_eq!(error.code(), LAUNCH_RUNTIME_TOO_OLD); + assert_eq!(error.message(), runtime_too_old_message(25)); + assert!(error.message().contains("Java 25 or later")); + assert!(fs::read_dir(fixture.root.join("state")) + .unwrap() + .next() + .is_none()); + + params["tools"] = json!({ + "jdtls-runtime": {"executable": "/jdk25/bin/java", "home": "/jdk25", "version": "25.0.4.1"} + }); + let request_25 = parse_launch_params(¶ms).unwrap(); + assert!(resolve( + &request_25, + &server_25, + &fixture.package(), + &[], + &[], + 1_000_000, + &report, + ) + .is_ok()); } #[test] diff --git a/backend/tests/repository_pins.rs b/backend/tests/repository_pins.rs index d6042e4..cf2aa6e 100644 --- a/backend/tests/repository_pins.rs +++ b/backend/tests/repository_pins.rs @@ -213,9 +213,56 @@ fn the_users_jdt_ls_runs_on_the_declared_runtime_tool() { .iter() .find(|definition| definition["id"] == "java") .unwrap(); - // The runtime finds JDKs where the project JDK is found. - assert_eq!(runtime["discovery"], java["discovery"]); + // The runtime finds JDKs where the project JDK is found, plus the JREs + // bundled inside VS Code and Cursor `redhat.java` extensions. + let java_discovery = java["discovery"].as_array().unwrap(); + let runtime_discovery = runtime["discovery"].as_array().unwrap(); + assert!( + runtime_discovery.len() <= 16, + "Core allows at most 16 discovery entries per tool" + ); + assert_eq!(&runtime_discovery[..java_discovery.len()], java_discovery); + let extra_patterns: Vec<&str> = runtime_discovery[java_discovery.len()..] + .iter() + .map(|entry| text(entry, "pattern")) + .collect(); + assert_eq!( + extra_patterns, + [ + ".vscode/extensions/redhat.java-*/jre/*", + ".cursor/extensions/redhat.java-*/jre/*", + ] + ); assert_eq!(runtime["executableLayouts"], java["executableLayouts"]); + let runtime_pattern = text(&runtime["version"], "pattern"); + for rejected in [ + r#"java version "1.8.0_301""#, + r#"openjdk version "11.0.20""#, + r#"openjdk version "17.0.10""#, + r#"openjdk version "20.0.2""#, + ] { + assert!( + !rejected.contains("version \"21") && { + // `jdtls-runtime` only matches Java 21+, so an older `java` on + // PATH cannot shadow a discovered JDK 21+. + let digits = rejected.split('"').nth(1).unwrap(); + let major: u64 = digits + .strip_prefix("1.") + .unwrap_or(digits) + .split('.') + .next() + .unwrap() + .parse() + .unwrap(); + major < MINIMUM_SERVER_JAVA_VERSION + }, + "{rejected}" + ); + } + assert!( + runtime_pattern.contains("2[1-9]") && !runtime_pattern.contains("(?:1\\.)?"), + "jdtls-runtime version.pattern must require Java 21+: {runtime_pattern}" + ); // It exports nothing, so JDT LS keeps the environment the host gives it. assert!(runtime.get("exports").is_none()); assert!(runtime.get("pathPrepend").is_none()); diff --git a/docs/feature-matrix.md b/docs/feature-matrix.md index ffc47e9..0607775 100644 --- a/docs/feature-matrix.md +++ b/docs/feature-matrix.md @@ -5,7 +5,7 @@ | 能力 | macOS | Windows | Linux | 证据 | | --- | --- | --- | --- | --- | | 使用用户安装的 JDT LS(设置目录、`JDTLS_HOME`、`PATH` 上的 `jdtls`、Homebrew、mason.nvim、Scoop、VS Code Java 扩展) | implemented / verified | implemented / pending | implemented / pending | `backend/src/jdtls.rs` 单元测试;macOS arm64 本机用 Homebrew JDT LS 1.60.0 和固定的 1.61.0 跑 `scripts/compiler/test-live.mjs`(普通与 Eclipse 工程),核对插件包与 JDT LS 安装文件不变 | -| 用 `jdtls-runtime` 工具(JDK 21+)运行 JDT LS,低于 21 时报错 | implemented / verified | implemented / pending | implemented / pending | `backend/src/launch.rs` 单元测试;本机 JDK 21、26 均已验证,JDK 26 运行 JDT LS 时需宿主传入项目 JDK | +| 用 `jdtls-runtime` 工具(仅匹配 JDK 21+,含 VS Code / Cursor `redhat.java` 自带 JRE)运行 JDT LS,低于目标 JDT LS bundle 要求的最低 Java 版本(如 21 或 25)时报错 | implemented / verified | implemented / pending | implemented / pending | `backend/src/jdtls.rs`、`backend/src/launch.rs`、`backend/tests/repository_pins.rs` 单元测试;本机 JDK 21、25、26 均已验证,JDK 26 运行 JDT LS 时需宿主传入项目 JDK | | 插件包不含 JDT LS 和 JDK | implemented / verified | implemented / pending | implemented / pending | `scripts/verify-package.sh`、`scripts/package/build-linux.mjs`;macOS arm64 包 11.3 MiB | 2026-11-16:Windows 与 Linux 的原生结果以 CI 和后续实机验证为准,本机结果不能推断。 diff --git a/io.github.lithe-idea.java-support/plugin.json b/io.github.lithe-idea.java-support/plugin.json index a9e0633..1974f84 100644 --- a/io.github.lithe-idea.java-support/plugin.json +++ b/io.github.lithe-idea.java-support/plugin.json @@ -322,7 +322,7 @@ "arguments": [ "-version" ], - "pattern": "version \\\"(?:1\\.)?(\\d+(?:\\.\\d+)*)" + "pattern": "version \\\"((?:2[1-9]|[3-9]\\d|\\d{3,})(?:\\.\\d+)*)" }, "homeLayouts": [ { @@ -476,6 +476,18 @@ "platforms": [ "linux" ] + }, + { + "root": { + "kind": "home" + }, + "pattern": ".vscode/extensions/redhat.java-*/jre/*" + }, + { + "root": { + "kind": "home" + }, + "pattern": ".cursor/extensions/redhat.java-*/jre/*" } ], "commands": [