Skip to content

feat(jdtls): surface Lombok-generated methods in document symbols#1434

Open
a-simeshin wants to merge 3 commits intooraios:mainfrom
a-simeshin:feat/jdtls-include-generated-code
Open

feat(jdtls): surface Lombok-generated methods in document symbols#1434
a-simeshin wants to merge 3 commits intooraios:mainfrom
a-simeshin:feat/jdtls-include-generated-code

Conversation

@a-simeshin
Copy link
Copy Markdown
Contributor

@a-simeshin a-simeshin commented Apr 28, 2026

Closes #1432.

Bumps bundled vscode-java 1.42.0-5611.54.0-923 and enables JDTLS' new java.symbols.includeGeneratedCode preference (eclipse.jdt.ls#3706) so Lombok-generated methods (getX/setX, builder(), equals/hashCode/toString, ...) finally appear in find_symbol / get_symbols_overview / replace_symbol_body / insert_*_symbol.

Changes

  • New ls_specific_settings.java.lombok_show_generated setting (default true) — flip to false to hide synthetic methods if @Data classes overload the outline.
  • FileUtils._extract_zip_archive: unlink existing entries before write — fixes PermissionError re-extracting over read-only plugin jars (every user hits this on the version bump).
  • Test fixture: Lombok dep + @Data @Builder class, regression test on find_symbol.

Test plan

  • uv run pytest test/solidlsp/java/ — 40/40 passed (including new Lombok regression test, full VSIX 1.54 download verified).

a-simeshin and others added 2 commits April 28, 2026 22:37
vscode-java VSIX archives ship some plugin jars (e.g. slf4j.api_*.jar) with
mode 0o444. When re-extracting the archive over an existing install — for
example after bumping vscode_java_version — open(target, "wb") would fail with
EACCES because the prior file is read-only. Unlink any pre-existing entry
before writing so re-extracts always land cleanly. Added a unit test that
mirrors the exact failure mode (read-only target, zip storing 0o444 mode).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
JDTLS' DocumentSymbolHandler filtered out every SourceMethod where
JDTUtils.isGenerated() was true, so Lombok-synthesised methods (getX/setX,
builder(), equals/hashCode/toString, withX, fluent accessors, ...) never
reached the LSP client. As a result Serena's symbol-aware tools — find_symbol,
get_symbols_overview, replace_symbol_body, insert_before_symbol,
insert_after_symbol — could not see, address or edit any Lombok-generated
member; only search_for_pattern / replace_content (text-based) worked.
Generated classes / fields / constructors were already visible because the
filter only ran on SourceMethod, which exactly matches the asymmetric
behaviour reported in oraios#1432.

Upstream introduced an opt-in preference java.symbols.includeGeneratedCode
in eclipse-jdtls/eclipse.jdt.ls#3706 (merged 2026-02-24) and surfaced it
through redhat-developer/vscode-java#4335. First vscode-java release with
the new JDTLS build is v1.53.0 (2026-02-26). Serena was pinned to v1.42.0-561
(May 2025) — well before the fix existed.

Changes:
- Bump bundled vscode-java from 1.42.0-561 to 1.54.0-923 (also brings JRE
  21.0.10, Lombok 1.18.39 and Equinox launcher 1.7.100 — paths and SHA256
  hashes updated for all 5 platforms).
- Send java.symbols.includeGeneratedCode in JDTLS init params, controlled by
  a new ls_specific_settings.java.lombok_show_generated setting (default
  true). Set to false to restore the pre-fix outline if the extra getters /
  setters are noise on @Data-heavy classes.
- Test fixture: add Lombok dep to the Java test repo's pom.xml plus a
  @DaTa @builder LombokModel class. Regression test verifies that
  getName/setName/builder appear in document symbols by default.
- Docs + CHANGELOG: document the new setting and the runtime bump.

Closes oraios#1432

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MischaPanch
Copy link
Copy Markdown
Contributor

This is related to #1219 . We can't merge either until #1232 is addressed as to not break existing setups

…ing annotations

The issue (oraios#1432) lists every Lombok annotation that was failing — initial
fixture only covered @DaTa + @builder. Expanded LombokModel and the test to
verify @DaTa, @builder(toBuilder=true), @with, @AllArgsConstructor,
@NoArgsConstructor, @DeleGate plus a separate FluentLombokModel for
@accessors(fluent=true) prefix-stripped accessors. Asserts every
representative generated symbol surfaces in document symbols:
- @DaTa: getX/setX/equals/hashCode/toString
- @builder(toBuilder=true): builder()/toBuilder()/build() + inner builder class
- @with: withX
- @DeleGate: forwarder methods (greet/farewell) for the delegate target
- ctors: @AllArgsConstructor + @NoArgsConstructor (kind=9)
- @accessors(fluent=true): prefix-stripped host()/tag()

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JDTLS: Problems with detecting some of the generated Lombok methods

2 participants