redhat-developer / redhat-developer/vscode-java

IDE fails to resolve correct class when duplicate classes exist across multiple JARs (shaded vs non-shaded)

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

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

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

説明

Description

The class org.apache.hadoop.security.authentication.server.AuthenticationHandler is present in both the jars i have:

  • hadoop-client-api.jar (shaded version)
  • hadoop-auth.jar (non-shaded version)

In the shaded JAR (hadoop-client-api.jar), AuthenticationHandler references HttpServletRequest from a relocated (shaded) servlet package.
In hadoop-auth.jar, the same class references javax.servlet.HttpServletRequest.

This leads to ambiguous class resolution in VS Code.
In our case, the VS Code Java extension mistakenly resolves the shaded AuthenticationHandler from hadoop-client-api.jar instead of the correct one from hadoop-auth.jar, resulting in a type mismatch when extending the class.

Reference screenshot

Image

Environment

Hadoop version: 3.4.0
Java version: 17.0.16
Build tool: Gradle 8.14
IDE: VS Code with Java extension (vscjava.vscode-gradle 3.17.1)

Steps to Reproduce

  • Create a Gradle project depending on two JARs that contain the same class name.
  • One JAR uses a shaded package (e.g., org.apache.hadoop.shaded.*).
  • Reference the class from the unshaded JAR.
  • Observe that VS Code reports type mismatch or class conflict, while Gradle CLI builds successfully.

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

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

はじめの一歩

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

調査の方向性

issue に記載されている Gradle の再現から始め、shaded JAR と unshaded JAR の重複したクラスを使用します。VS Code Java extension が Gradle CLI と比較してどのようにクラスを解決するかを追跡し、型の不一致なしで unshaded の AuthenticationHandler が選択された場合に補完が行われることを確認します。

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

評価

技術スタック
java, typescript, vscode
領域
developer-experience, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

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

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