redhat-developer / redhat-developer/vscode-java

Importing package from non-transitively exposed dependency in Gradle project does not display error

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

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

Gradle
主要言語
TypeScript
スター
2.3k
フォーク
546
平均マージ
20時間 1分
マージ済み PR(30日)
11

説明

Gradle enables Java library authors to specify what dependencies should be transitively exposed to a consumer using the api or implementation configurations in the dependencies section of the library's build script. When a Gradle application project attempts to use a class from a transitive dependency of a library that has declared that dependency non-transitively exposed (using implementation), the gradle build command fails at the import declaration as expected, but this extension reports no errors in VS Code likely because it sees the dependency on the classpath and ignores its transitive visibility setting. This extension will also provide hinting and code completion for a non-transitively exposed library, which shouldn't be happening.

Environment
  • Operating System: macOS/Docker ARM64
  • JDK version: OpenJDK Runtime Environment Corretto-21.0.4.7.1
  • Visual Studio Code version: 1.91.1 (through code-server)
  • Java extension version: 1.33.0 (through OpenVSX)
Steps To Reproduce
  1. Download the reproduction project.
  2. Open Test.java in VS Code and observe no compilation errors reported by this language server extension.
  3. Run gradle build, which will fail, and observe the compilation errors due to Test.java attempting to access the class of a non-transitively exposed dependency (com.google.common.base.Preconditions in the example) of the alpaca-java library.

Reproduction project: workspace.zip
Logs: Log.txt (nothing out of the ordinary)

Current Result

VS Code shows no errors:
VS Code

Expected Result

IntelliJ does show errors:
IntelliJ

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

添付された workspace.zip から始め、Test.java を開いて gradle build を実行し、そのコンパイラーエラーを language server の診断と比較します。Gradle の依存関係設定と Log.txt を読み、続いて依存関係の可視性の処理を追跡して、アクセスできない Guava import がエラーを生成し、ヒントや補完を受けないようにします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, vscode
領域
build-system, devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

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

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