redhat-developer / redhat-developer/vscode-java
IDE fails to resolve correct class when duplicate classes exist across multiple JARs (shaded vs non-shaded)
まだ誰も着手していません。
- 主要言語
- 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
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.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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