IDE fails to resolve correct class when duplicate classes exist across multiple JARs (shaded vs non-shaded)
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 42/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- java, typescript, vscode
研究方向
從 issue 中描述的 Gradle 重現開始,使用來自 shaded 和 unshaded JAR 的重複類別。追蹤 VS Code Java extension 相較於 Gradle CLI 如何解析該類別,並驗證在選取 unshaded AuthenticationHandler 且不存在型別不匹配時補全是否正常。
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- TypeScript
- 星號
- 2.3k
- 分支
- 547
- 平均合併
- 5 小時 36 分鐘
- 30 天內合併 PR
- 10
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
redhat-developer/vscode-java 的其他 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 75/100
redhat-developer/vscode-java#4511 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
redhat-developer/vscode-java#4426 ·
維護者通常 1 天內回覆
-
bug
難度 4/5 3-5 天 新手友好度 45/100
redhat-developer/vscode-java#4506 · 7 則留言 · 4 個 reaction ·
維護者通常 1 天內回覆
-
bug
難度 4/5 3-5 天 新手友好度 45/100
redhat-developer/vscode-java#4505 · 5 則留言 · 2 個 reaction ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 52/100
redhat-developer/vscode-java#4504 · 3 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
查看 redhat-developer/vscode-java 的全部 Issue
相似的 Issue
-
難度 1/5 1-3 小時 新手友好度 88/100
supabase/agent-skills#611 ·
-
難度 1/5 1 小時以內 新手友好度 68/100
polka-codes/test#345 ·
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 92/100
GoogleChromeLabs/project-sesame#217 ·
維護者通常 12 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
solana-foundation/solana-com#2202 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 85/100