redhat-developer / redhat-developer/vscode-java

JDT LS fails to resolve lombok.config in single-folder Maven projects

Ouverte
#4,461 1 commentaire 1 réaction 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

bug
Langage dominant
TypeScript
Étoiles
2.3k
Forks
546
Merge moyen
20 h 1 min
PR mergées (30 j)
11

Description

Bug Report Issue: lombok.config not loaded in single-folder Maven project

Describe the bug

When opening a Maven multi-module project via VSCode's "Open Folder" (single-folder mode), the lombok.config file at the project root is completely ignored. Lombok annotations work (e.g., @Data, @Getter), but all settings in lombok.config (such as lombok.accessors.chain=true, lombok.tostring.callsuper=CALL) are not applied. The editor shows errors where it shouldn't, e.g., setter methods not returning this for chaining, or toString() not calling super.toString().

The project compiles fine from command line (mvn clean compile passes without errors), which confirms the lombok.config file itself is correct and Maven picks it up properly. The issue is exclusively within the JDT Language Server's handling of lombok.config in VSCode's single-folder mode.

Notably, opening the same project via .code-workspace file (workspace mode) works correctly — lombok.config is loaded and all settings take effect.

To Reproduce

  1. Create or open a Maven multi-module project with a lombok.config file at the project root directory
  2. Open the project via VSCode's "Open Folder" (single-folder mode, NOT workspace mode)
  3. Configure lombok.config with non-default settings, e.g.:
    lombok.accessors.chain=true
    lombok.tostring.callsuper=CALL
    lombok.equalsandhashcode.callsuper=CALL
    
  4. Create a class with @Data annotation and verify:
    • Setters should return this (chain = true) but they return void (default behavior)
    • toString() should call super.toString() but it doesn't
  5. Run mvn clean compile from terminal — this works correctly, confirming the config file is valid

Expected behavior

lombok.config at the project root should be discovered and applied by JDT LS, even in single-folder mode. All configured settings (chain, callsuper, etc.) should take effect in the editor's language features.

Environment

Item Value
Operating System Windows 11 Home Chinese Edition (Version 2009)
JDK Oracle GraalVM 21.0.10+8.1 (build 21.0.10+8-LTS-jvmci-23.1-b84)
Visual Studio Code 1.128.0 (x64)
Java Extension (redhat.java) 1.55.0
Java Extension Pack 0.31.1
Lombok version 1.18.46
Project type Maven multi-module (ruoyi-vue-pro)

Additional Information

What works
  • Opening the project via .code-workspace file (workspace mode): lombok.config loads correctly
  • mvn clean compile from command line: compiles correctly with all lombok.config settings applied
What does NOT work (all attempted and failed)
  1. Lombok version upgrade: Using 1.18.46, well above the 1.18.28 fix for Eclipse 4.27 compatibility (issue #2887)
  2. Manual -javaagent injection: Setting java.jdt.ls.vmargs to -javaagent:<path>/lombok-1.18.46.jar in .vscode/settings.json — no effect
  3. Disabling built-in Lombok support: Setting java.jdt.ls.lombokSupport.enabled: false + manual javaagent — no effect
  4. Copying lombok.config to src/main/java/: No effect
  5. Removing config.stopBubbling: No effect
  6. Java: Clean Java Language Server Workspace after each change: No effect
Suspected root cause

Based on Lombok source code analysis (FileSystemSourceCache.forUri() and EclipseAST.getAbsoluteFileLocation()), the issue likely lies in how JDT LS resolves the source file URI in single-folder mode. In workspace mode, the .code-workspace file provides a clear project root context, allowing JDT LS to pass correct absolute file paths to Lombok. In single-folder mode, the Invisible Project mechanism may resolve URIs differently, causing Lombok's lombok.config discovery (which walks up from the source file's parent directory) to never reach the actual project root directory where lombok.config resides.

Related issues
  • #2887lombok.config ignored in 1.14.0 (fixed in Lombok 1.18.28 for Eclipse 4.27 compatibility)
  • projectlombok/lombok#3332 — The upstream Lombok fix for Eclipse 4.27
lombok.config content
lombok.tostring.callsuper=CALL
lombok.equalsandhashcode.callsuper=CALL
lombok.accessors.chain=true

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par suivre Lombok's FileSystemSourceCache.forUri() et EclipseAST.getAbsoluteFileLocation() à travers la gestion de single-folder et d'Invisible Project par JDT LS. Comparez les URI des fichiers source et la résolution de la racine du projet avec workspace mode ; l'issue est terminée lorsque la root lombok.config est détectée en single-folder mode et que ses paramètres affectent les fonctionnalités de langage de l'éditeur.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java, vscode
Domaine
devtools, tooling
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
48/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.