vscode-java
vscode-java copied to clipboard
1.42.0 with Lombok @Builder does not work with records
Hi. I've got jsut update vscode-java 1.41.1 to 1.42.0
before update, it's okay,
import io.tienipia.model.Template;
import java.util.List;
import lombok.Builder;
@Builder
record TemplateResponse(List<Template> templates) {}
but after upgrade to 1.42.0
The constructor TemplateResponse() is undefinedJava(134217858)
It occurs every vscode with 1.42.0
of course, manual build with maven works fine.
mvn clean compile
lombok version does not affect to this issue.
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<!-- <version>1.18.38/version> NOT WORKING -->
<!-- <version>1.18.36</version> NOT WORKING -->
<!-- <version>1.18.34</version> NOT WORKING -->
<scope>provided</scope>
</dependency>
1.18.38 1.18.36 1.18.34
Is the issue specifically with annotating records or does it occur on other type declarations as well ?
Update: I can confirm it seems to be an issue with records. @Builder on other type declarations worked.
+1 same issue spotted in the v1.42.0
I've the same issue in v1.42.0
I wish I found this before completely uninstalling and reinstalling vs code. I rolled back the extension to the previous stable and things are back to normal.
Seems to be there in prerelease 1.43.2025051708 as well. In previous 1.41.1 the problem does not appear.
The same problem happens to me after updating vscode from 1.98 to 1.100.2 in Kali linux.
I have the same issue v1.42.0
Same is happening for me. I am using VSCode Version: 1.100.2 (Universal). I also tried providing my own lombok.jar using java.jdt.ls.vmargs but it did not work.
This broke my entire workflow, have to resort to using IntelliJ.
Same is happening for me. I am using VSCode Version: 1.100.2 (Universal). I also tried providing my own lombok.jar using java.jdt.ls.vmargs but it did not work.
This broke my entire workflow, have to resort to using IntelliJ.
FYI @ankurkesharwani You can force the red-hat extension version to 1.41.1 to avoid switching to IntelliJ
Same issue here. Rolled back to 1.41.1 fixed it.
We were using @With with records and it also broke with 1.42.0. Rollback to 1.41.1 worked.
Thanks a bunch @pastouret !
thanks a lot! @pastouret. Downgrading to 1.41.1 solved the issue!
Same here, have to downgrade to make it work. PLZ fix it
Same here; also couldn't use any of the ide tools to compile, run unit or integration tests. rolling back to 1.41.1 fixed the linter, compile, and test explorer runner.
I've built Lombok from their development branch, with the PR from https://github.com/projectlombok/lombok/pull/3888 applied. It can be accessed at https://github.com/rgrunber/lombok/releases/download/pull-3888/lombok-1.18.39.jar ( https://github.com/rgrunber/lombok/releases/tag/pull-3888 ) . From what I can tell, it should solve the issue. People are free to try it out and confirm. There's a few ways to do this, after updating to vscode-java 1.42.0 :
Option 1 : Use in place of your existing project's Lombok library.
If Lombok is referenced in the configuration of your build tools (eg. pom.xml, build.gradle), you'll have to install it first so your build system can detect it.
For a Maven project :
$ mvn install:install-file -Dfile=/home/user/Downloads/lombok-1.18.39.jar -DgroupId=org.projectlombok -DartifactId=lombok -Dversion=1.18.39 -Dpackaging=jar
After that you can update your pom file(s) to refer to Lombok 1.18.39. Finally, when you load your project, you just need to make sure to "Use Project's Version" over the extension's and reload the project.
Option 2 : Replace vscode-java's embedded lombok library
vscode-java provides a version of Lombok and it is used when Lombok is detected on the classpath. You can always switch to your own project's Lombok version (see above), but this is the default one.
~/.vscode/extensions/redhat.java-1.42.0-${platform}/lombok/lombok-1.18.36.jar
If you move the new jar into this location :
rm ~/.vscode/extensions/redhat.java-1.42.0-linux-x64/lombok/lombok-1.18.36.jar
mv ~/Downloads/lombok-1.18.39.jar ~/.vscode/extensions/redhat.java-1.42.0-linux-x64/lombok/
then your vscode-java extension will now use that by default which should fix any issues. You would just need to confirm your project is set to "Use Extension's Version" and not the project's version.
I can confirm the @rgrunber fix is working fine in Eclipse 2025-06. My installation steps also were:
- Copy lombok-1.18.39.jar into eclipse directory.
- Replace in eclipse.ini the entry:
-javaagent:/opt/apps/eclipse/plugins/org.projectlombok.agent_1.18.38/lombok.jarfor the line-javaagent:/opt/apps/eclipse/lombok-1.18.39.jar - Restart eclipse
Thank you
I've embedded the development version of Lombok (towards 1.18.39) along with the PR that fixes this issue into vscode-java, rather than using a released (1.18.38) version that lacks the fix. This should resolve the issue in pre-releases and the upcoming 1.43.0 release without needing to perform any of the steps at https://github.com/redhat-developer/vscode-java/issues/4050#issuecomment-2955782487 .
This must come as a huge relief for many developers who either struggled with this issue or weren’t even aware of the cause. Thank you for resolving it — your work is truly appreciated. @rgrunber
Can there be some kind of lombok interoperability testing establish before releasing a plugin update? This happens ever so often.
Hi! I've just upgraded to 1.43.0 released yesterday, but I'm still experiencing similar issues with Lombok. I tried two Lombok versions - the extension's one and the one from my project. I'm getting similar compilation errors again. Can anyone confirm 1.43.0 resolved the issue? 🤔
It's OK for me with 1.43 version (I was using pre-release until today and switch to release this morning).
Can there be some kind of lombok interoperability testing establish before releasing a plugin update? This happens ever so often.
This is the responsibility of the Lombok project. Lombok uses internal Eclipse JDT APIs which change from time to time, when using such internal code it is important to monitor changes upstream and adapt to them proactively. The fact that a PR fixing this issue in Lombok itself has remained un-merged for a month points to a larger issue of inactive maintenance from Lombok's side.
@ericwill as I understood the comment from rgrunder lombok is also shipped with vscode-java in a version that is causing this issue.
That was done as one-time effort to resolve user complaints because the Lombok project maintainers are slow to react (the PR to fix the issue in Lombok is still open!). VS Code Java does not maintain Lombok.
@ericwill got you, if there just would exist a lombok alternative