redhat-developer / redhat-developer/vscode-java
Java Runtime incorrect, when using gradle toolchains
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.3k
- Fork
- 546
- Merge trung bình
- 20 giờ 1 phút
- Pull request đã merge (30 ngày)
- 11
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với build.gradle của dự án mẫu và lib/src/test/java/dev/levno/javarewriter/LibraryTest.java, sau đó tái hiện chẩn đoán trong VS Code và kiểm tra tab Configure Java Runtime. Hoàn tất khi dự án sử dụng Gradle toolchain của Java 17 không còn báo lỗi cấp độ nguồn của text block.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- devtools
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100