redhat-developer / redhat-developer/vscode-java
Java Runtime incorrect, when using gradle toolchains
未关闭
还没有人认领这个 Issue。
Gradle
runtime
- 主要语言
- TypeScript
- 星标
- 2.3k
- 派生
- 546
- 平均合并
- 20 小时 1 分钟
- 30 天内合并 PR
- 11
描述
I am using the following build.gradle file:
plugins {
// Apply the java-library plugin for API and implementation separation.
id 'java-library'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
dependencies {
// Use JUnit test framework.
testImplementation 'junit:junit:4.13'
// This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:29.0-jre'
// Java Parser and Code Generator
implementation 'com.github.javaparser:javaparser-symbol-solver-core:3.24.7'
}
It uses the Java 1.17 toolchain, however in the Configure Java Runtime Tab, it shows Java Version 12:
When I try to use newer Java features, it shows the following Error:
The Java feature 'Text Blocks' is only available with source level 15 and above
Environment
- Operating System: Windows 10
- JDK version: 1.17
- Visual Studio Code version:
- Java extension version: 1.12.0
- Gradle version: 7.0.0
Steps To Reproduce
Sample Project: java-rewriter.zip
- open lib/src/test/java/dev/levno/javarewriter/LibraryTest.java in vscode
- Error is shown
Current Result
Error is displayed in File
Expected Result
No Error should be displayed
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先查看示例项目的 build.gradle 和 lib/src/test/java/dev/levno/javarewriter/LibraryTest.java,然后在 VS Code 中重现该诊断并检查 Configure Java Runtime 选项卡。当使用 Java 17 Gradle 工具链的项目不再报告文本块源级别错误时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100