redhat-developer / redhat-developer/vscode-java

Java Runtime incorrect, when using gradle toolchains

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

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

Gradle runtime
主要言語
TypeScript
スター
2.3k
フォーク
546
平均マージ
20時間 1分
マージ済み PR(30日)
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:
Capture

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

  1. open lib/src/test/java/dev/levno/javarewriter/LibraryTest.java in vscode
  2. Error is shown
Current Result

Error is displayed in File

Expected Result

No Error should be displayed

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. 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

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

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