False positive "Flexible Constructor Bodies is only available with source level 25 and above" with Lombok @RequiredArgsConstructor on Java 21
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 52/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- 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
[email protected]. - 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.
- Linguagem predominante
- TypeScript
- Estrelas
- 2.3k
- Forks
- 548
- Merge médio
- 8h 20min
- PRs com merge (30d)
- 6
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de redhat-developer/vscode-java
-
JDK_HOME can be sorted after lower-priority auto-detected JDK sourcesTalvez já em andamento @shblue21 assumiu há 114 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
redhat-developer/vscode-java#4426 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
redhat-developer/vscode-java#4537 ·
Mantenedores costumam responder em até 1 dia
-
bug need info
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
redhat-developer/vscode-java#4520 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
redhat-developer/vscode-java#4517 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Red Hat Not ActivatingAbertabug documentation
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 25/100
redhat-developer/vscode-java#4516 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de redhat-developer/vscode-java
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
rajbos/ai-engineering-fluency#2340 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
community documentation first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 70/100
lingdojo/kana-dojo#31864 · 1 comentário · 5 reações ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
zenstackhq/zenstack#2873 ·
Mantenedores costumam responder em até 1 dia
-
CLI: TUI shows onboarding when the provider's API key is only in the environment (e.g. OPENROUTER_API_KEY)Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. AbertaCLI
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
cline/cline#14923 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
paperclipai/paperclip#15490 ·
Mantenedores costumam responder em até 1 dia