Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#4,521 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java
領域
tooling

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
2.3k
フォーク
548
平均マージ
7時間 10分
マージ済み PR(30日)
7

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

redhat-developer/vscode-java のほかの issue

redhat-developer/vscode-java の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。