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 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
TypeScript
星标
2.3k
派生
547
平均合并
20 小时 1 分钟
30 天内合并 PR
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. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 issue 中描述的 Gradle 复现开始,使用来自 shaded 和 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 摘要。