mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-05 08:14:50 +00:00
* Java (JDT-LS): allow registering additional JRE/JDK runtimes via config JDT-LS resolves each imported module's JRE_CONTAINER/.../JavaSE-NN/ classpath entry against its own "Installed JREs" list, which Serena previously hardcoded to a single JavaSE-21 entry pointing at the bundled JRE. Projects whose source/target level exceeds that bundled JDK (e.g. sourceCompatibility = VERSION_25) get a container that never resolves, so every JDK type -- java.lang.Object, java.util.*, etc. -- comes back "cannot be resolved", silently breaking diagnostics and cross-module resolution. There was no config key to tell JDT-LS about an installed newer JDK. Add an optional `runtimes` list under ls_specific_settings.java, mirroring VS Code's java.configuration.runtimes shape (name, path, optional default/sources/javadoc). Entries are validated (name+path required, path must exist) via the new _resolve_configured_runtimes(), then merged with the bundled JavaSE-21 default: configured runtimes extend the list; an entry reusing the "JavaSE-21" name overrides the bundled one; if a configured entry claims `default`, the bundled runtime's own default flag is cleared so JDT-LS doesn't see two defaults. The `runtimes` key is also added to the JDTLS workspace-hash inputs so changing it lands in a fresh workspace instead of reusing a stale Buildship/Maven import. Testing: added 14 unit tests in test/solidlsp/java/test_jdtls_path_resolution.py covering _resolve_configured_runtimes validation (missing keys, wrong types, nonexistent paths) and the merge behavior in _create_base_initialize_params (extension, name-collision override, default hand-off). Ran `poe format`, `poe type-check`, and `pytest test/solidlsp/java -m "not java"` (69 passed, 8 deselected real-JDTLS tests that require a JDK) locally. Fixes #1478 * docs: document java.runtimes in configuration guide Address review feedback on #1715 by documenting ls_specific_settings.java.runtimes in 050_configuration.md (settings table, note, and example). Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: arimu1 <19286898+arimu1@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>