Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

False positive "Flexible Constructor Bodies is only available with source level 25 and above" with Lombok @RequiredArgsConstructor on Java 21

Ouverte
#4,521 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

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

Piste de recherche

Start with the minimal Maven reproducer and its Java 21 maven.compiler.release setting, then reproduce the diagnostic in VS Code with [email protected]. Compare the JDT Language Server/Lombok processing of @RequiredArgsConstructor with Maven's successful build; done means the false Java 25 Flexible Constructor Bodies diagnostic no longer appears for the reproducer.

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

Description

bug
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: [email protected] (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
  1. Create a Maven project targeting Java 21.
  2. Add Lombok.
  3. Create a class containing a final field.
  4. Add Lombok @RequiredArgsConstructor.
  5. Open the project in VS Code with [email protected].
  6. 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.

Langage dominant
TypeScript
Étoiles
2.3k
Forks
548
Merge moyen
7 h 10 min
PR mergées (30 j)
7

Préparer son environnement

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.

Autres issues de redhat-developer/vscode-java

Toutes les issues de redhat-developer/vscode-java

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

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