Repository navigation
Description
Description
I am seeing a false-positive Java compiler diagnostic in VS Code when using Lombok @RequiredArgsConstructor in a Java 21 Maven project.
The project compiles and installs successfully with Maven, but VS Code reports:
The Java feature 'Flexible Constructor Bodies' is only available with source level 25 and above
The source code itself does not use Flexible Constructor Bodies or any Java 25 syntax.
Environment
- VS Code Java extension:
redhat.java@1.57.2026093008(pre-release) - Project source level: Java 21
- Build system: Maven
- Lombok: used through Maven dependency / annotation processing
mvn install: SUCCESS
Minimal reproducer
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public class Test {
private final String value;
}Maven configuration:
<properties>
<maven.compiler.release>21</maven.compiler.release>
</properties>Steps to reproduce
- Create a Maven project targeting Java 21.
- Add Lombok.
- Create a class containing a
finalfield. - Add Lombok
@RequiredArgsConstructor. - Open the project in VS Code with
redhat.java@1.57.2026093008. - Let the Java Language Server finish importing and analysing the project.
Actual behavior
VS Code reports:
The Java feature 'Flexible Constructor Bodies' is only available with source level 25 and above
even though the source code does not contain a constructor using Flexible Constructor Bodies.
The error appears to be related to the constructor generated by Lombok.
Expected behavior
No Java 25 / Flexible Constructor Bodies diagnostic should be reported.
The generated constructor is equivalent to ordinary Java 21-compatible code:
public Test(String value) {
this.value = value;
}Maven result
The project builds successfully:
mvn install
BUILD SUCCESS
Therefore the issue appears to be limited to VS Code / JDT Language Server diagnostics rather than the Maven compiler configuration.
Additional information
The same issue occurs in a real Spring project using:
@RequiredArgsConstructor
public class ProdCatalog {
private final DoubleThrower<RestFunctionsException, RuntimeException> thrower;
private final NamedParameterJdbcTemplate jdbc;
}There is no explicit constructor in the class.
The diagnostic is therefore likely triggered during Lombok/JDT AST processing of the generated required-arguments constructor.
I am using the 1.57 pre-release because of a separate issue present in 1.56.0, so reverting to 1.56.0 is not currently a practical workaround.
Please let me know if a Java Language Server log, Lombok version, complete pom.xml, or a minimal reproducer repository would be useful.
I managed to replicate this. It's also filed upstream in lombok: projectlombok/lombok#4084 . vscode-java reuses parts of Eclipse. Lombok support in Eclipse relies on a bunch of hacks to the internals of Eclipse's Java compiler (ECJ), so sometimes when there's new features, fixes or refactorings in that compiler, it breaks Lombok.
From my past experience, lombok is slow to address these things, but it seems like one of the committers someone who contributes to the project frequently has assigned themselves, so maybe it'll be addressed at some point.
Activity
datho7561 commentedon Oct 5, 2026
I managed to replicate this. It's also filed upstream in lombok: projectlombok/lombok#4084 . vscode-java reuses parts of Eclipse. Lombok support in Eclipse relies on a bunch of hacks to the internals of Eclipse's Java compiler (ECJ), so sometimes when there's new features, fixes or refactorings in that compiler, it breaks Lombok.
From my past experience, lombok is slow to address these things, but it seems like
one of the committerssomeone who contributes to the project frequently has assigned themselves, so maybe it'll be addressed at some point.tomas-bucki-pds commentedon Oct 5, 2026
@datho7561 thanks, in the meantime we downgraded to 1.55 where no such problem appears.
acarcher commentedon Oct 13, 2026
Same issue on the stable release.
Environment
Notes
-javaagentat lombok-1.18.42.jar removed the Flexible Constructor Bodies error, but Lombok then didn't take effect ("The blank final field ... may not have been initialized").Kerbores commentedon Oct 14, 2026
me too!
danrriv commentedon Oct 14, 2026
I had the same issue with Java 21 and Lombok 1.18.46. Gradle compiled fine, but VS Code kept showing this error. Downgrading the Java extension to 1.56.0 fixed it for me. Thanks for sharing the workaround!
chrispyleLAC commentedon Oct 14, 2026
Seeing the same thing, but on Java 17 and with other Lombok annotations, so it doesn't look specific to
@RequiredArgsConstructoror Java 21.Environment
lombok-1.18.39-4050.jarJavaLanguageVersion.of(17), Lombok 1.18.30Symptoms
~250 errors across 56 files:
The Java feature 'Flexible Constructor Bodies' is only available with source level 25 and aboveEvery error is reported on a Lombok annotation (
@Getter/@Builder/@Jacksonized). Example:maomaoke commentedon Oct 14, 2026
germandsantana commentedon Oct 14, 2026
similar issue, java 25 project with lombok
all lombok SuperBuilder don't compile
Cannot read field xxx in an early construction context
zhaiang commentedon Oct 14, 2026
same question in java17 project
TotoShampoin commentedon Oct 14, 2026
Welp, this bug forced me to downgrade back to 1.56.0
zhaiang commentedon Oct 14, 2026
yes, back to 1.56.0
chrispyleLAC commentedon Oct 14, 2026
Yup, I downgraded the extension back to 1.56.0 too!
JimmyRampage commentedon Oct 14, 2026
Same problem here, and downgrading solve the problem...
8 remaining items
javobalazs commentedon Oct 14, 2026
Got it, thx.
Hou-Xiaoxuan commentedon Oct 14, 2026
There has been some progress upstream: eclipse-jdt/eclipse.jdt.core#5489 identified the underlying Lombok/ECJ compatibility issue, and a backward-compatibility fix has already been merged in PR #5490.
While Lombok is also working on adapting to the new ECJ AST structure, upgrading Lombok may not be feasible for projects with pinned dependencies. Currently, we having to downgrade vscode-java to 1.56.0 as a workaround.
Could the next vscode-java release include a JDT Core/ECJ build containing this compatibility fix? This would help restore compatibility with existing Lombok versions without requiring changes to project dependencies.
hanjoosten commentedon Oct 14, 2026
I can confirm this issue with
redhat.java1.57.0 on Java 17 and Lombok 1.18.36. In our case the problem is more severe than an incorrect diagnostic: the Eclipse/JDT compilation performed by VS Code actually produces an invalid.classfile for a Lombok-generated builder.We get:
Inspecting the generated class with
javap -vshows that withredhat.java1.57.0 the Lombok-generated constructor has an emptyCodeattribute:We isolated this from Maven compilation. After deleting the generated builder
.class, merely touchingComponentPlanning.javawhile VS Code is running causes the Java language server to regenerate the invalid class.Downgrading only
redhat.javafrom 1.57.0 to 1.56.0 and repeating exactly the same test produces valid bytecode:After the downgrade, the
ClassFormatErrordisappears and the affected Cucumber tests run normally from VS Code Testing.Environment:
So this issue can affect not only editor diagnostics, but also the bytecode emitted by the incremental Eclipse/JDT compilation.
vhbui02 commentedon Oct 15, 2026
It seems the problem is fixed in VSCode Extension version 1.58.2026101408
hanjoosten commentedon Oct 15, 2026
When will this version be released?
yeahQing commentedon Oct 16, 2026
I have run into the same issue. Using version 1.56.0 can resolve this problem.
joarobles commentedon Oct 19, 2026
Same here, I can confirm version 1.56.0 fixes the issue.
Is there an estimated release date for this version?
AloisSeckar commentedon Oct 19, 2026
Just manually installed newly released
1.58.0in VS Code (the auto-update has 12 hours cooldown) and the issue is gone 👍datho7561 commentedon Oct 19, 2026
Closing this, since 1.58.0 should be released as of this morning, and it should fix the issue.
GioF71 commentedon Oct 19, 2026
Works, thank you.
EDIT: I updated the plugin without having to download anything manually of course.
TIS-liuz commentedon Oct 20, 2026
After upgrading to the 1.58 pre-release version, adding the following setting resolved the Java Language Server startup issue:
Once the stable version of 1.58 is released, this workaround may no longer be necessary and the setting might be removable.