redhat-developer / redhat-developer/vscode-java

Spurious warning about incompatible .class files version in required binaries

Open
#3,699 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

When I add logback 1.5.6 as a dependency in my POM, vscode tells me: “Incompatible .class files version in required binaries. Project 'simple' is targeting a 17 runtime, but is compiled against '(…)/.m2/repository/ch/qos/logback/logback-core/1.5.6/logback-core-1.5.6.jar' (from the container 'Maven Dependencies') which requires a 21 runtime”.

I believe that the warning is incorrect: extracting the content of .m2/repository/ch/qos/logback/logback-core/1.5.6/logback-core-1.5.6.jar and running javap -verbose on a few classes reveal a major version equal to 55.

The JAR is a multi-release one, including some classes specific to Java 21. I suspect that this confuses vscode.

Environment
  • Operating System: linux
  • JDK version: 17
  • Visual Studio Code version: 1.91.0
  • Java extension version: v0.27.0
Steps To Reproduce

Add logback 1.5.6 as a dependency in your POM.

Here is a sample project.

Logs (partial and redacted): messages, server.

Current Result

Warning

Expected Result

No warning

Additional Informations
  • mvn compile does not complain.
  • Might be related to #3319.
  • I posted an issue to logback before realizing that the problem seems to come from vscode.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Simple sample project, its POM, and the attached messages/server logs; reproduce on JDK 17 with logback 1.5.6 and inspect handling of multi-release JAR entries. Done means the sample no longer reports an incompatible class-file warning while Maven still compiles successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.